Linux-Bulgaria.ORG
навигация

 

начало

пощенски списък

архив на групата

семинари ...

документи

как да ...

 

 

Предишно писмо Следващо писмо Предишно по тема Следващо по тема По Дата По тема (thread)

Re: lug-bg: MySQL query


  • Subject: Re: lug-bg: MySQL query
  • From: gf@xxxxxxxxxxx (Georgi Chorbadzhiyski)
  • Date: Mon, 18 Nov 2002 15:28:17 +0200



krasimir wrote:
> öèòèðàì  Teodor Penev <tpenev@xxxxxx>:
> 
>> zdrasti lug-bg,
>> 
>> imam slednoto pitane:
>> MySQL tablica s razlichni poleta -
>> 
>> +--------+----------+
>> | id      | name    |
>> +---------+---------+
>> | 1       | joe     |
>> +---------+---------+
>> | 2       | jane    |
>> +---------+---------+
>> | n       | bill    |
>> +---------+---------+
>> 
>> 
>> celta e da vzema stoinostta na nai-goliamato 'id' (n)
>> (ili poslednoto) i da go vkaram v php code.
>> neshto kato SELECT id FROM table ORDER BY id WHERE id = '...'
>> ...
>> posle da uvelicha biggest id + 1 za nov zapis i t.n.
>> predpolagam che moje da se vikat stoinosttie na id (vsichkite)
>> v php i posle da se vzema nai-goliamato, no ne moga da go izmislia
>> v momenta...
>> 
>> any ideas? 10x
> 
> 
> 
> 
>  $result=mysql_query(sprintf("SELECT (MAX(tablename.id)+1) from 
> table.name;") , $link);
>  if($row = mysql_fetch_array($result))  {
>         if ($row[0]=='') $id=1; else
>         $id=$row[0];
>  } else {
>     exit();
>  }
>     mysql_query("insert into tablename values (".$id." , ...........)");
> 
> ako oshte ne si promenil poleto na auto increment moje da polzvash tozi 
> kod
> krasimir

I ako paralelno tozi kod se izpalniava 50-60 pyti v sekunda, kakvo shte stane ?
Osven tova e mnogo losha ideia da pravish selects, updates i inserts ednovremenno
v edna tablica na mysql.

============================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers).
http://www.linux-bulgaria.org - Hosted by Internet Group Ltd. - Stara Zagora
To unsubscribe: http://www.linux-bulgaria.org/public/mail_list.html
============================================================================



 

наши приятели

 

линукс за българи
http://linux-bg.org

FSA-BG
http://fsa-bg.org

OpenFest
http://openfest.org

FreeBSD BG
http://bg-freebsd.org

KDE-BG
http://kde.fsa-bg.org/

Gnome-BG
http://gnome.cult.bg/

проект OpenFMI
http://openfmi.net

NetField Forum
http://netField.ludost.net/forum/

 

 

Linux-Bulgaria.ORG

Mailing list messages are © Copyright their authors.