You are here: Re: Glitch in php or count() in mysql? « PHP Programming Language « IT news, forums, messages
Re: Glitch in php or count() in mysql?

Posted by Tony Marston on 10/24/05 05:56

"J.O. Aho" <user@example.net> wrote in message
news:3s1l8jFln4j6U1@individual.net...
> Tony Marston wrote:
>
>> You should be using 'select max(msg_id) from messagesdb;' instead of
>> 'select
>> count(*) from messagesdb'. In this way it will not matter if any previous
>> entries get deleted.

Not if you lock the table bfeore performing the 'select max(id)' and the
'insert'.

--
Tony Marston

http://www.tonymarston.net



> This can still generate doublets of msgid as the select statment can be
> trigged by two different people trying to add something,
> AUTO_INCREMENT UNIQUE should in most cases be used for ID (numerial)
> columns.
>
>
> //Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация