Re: RE: [PHP-DB] auto_increment in mysql

From: Date: Wed, 28 Mar 2001 11:44:25 +0000
Subject: Re: RE: [PHP-DB] auto_increment in mysql
Groups: php.windows 
Request: Send a blank email to php-windows+get-6354@lists.php.net to get a copy of this message
This sounds dodgy unless you can be sure that there will be no more than one person accessing the system at the same time, otherwise several users could calculate the same $howmanyrows. I think that AUTO_INCREMENT is a better idea altogether! Cheers -- Phil Driscoll Dial Solutions +44 (0)113 294 5112 http://www.dialsolutions.com http://www.dtonline.org -----Original Message----- From: Ben Cairns <BenC@intasept.com> To: Fai <fai5@hknet.com> Cc: php-windows@lists.php.net <php-windows@lists.php.net> Date: Wednesday, March 28, 2001 11:50 AM Subject: [PHP-WIN] RE: [PHP-DB] auto_increment in mysql >Set the column up in MySQL as a CHAR column, not an AUTO_INCREMENT > >and use this: > >$conn = mysql_connect(DB_HOST_HERE,DB_USER_HERE,DB_PASS_HERE); >mysql_select_db("DB_NAME_HERE",$conn); >$howmanyrows = mysql_query("SELECT * FROM YOUR TABLE where YOUR >CONDITION",$conn); >$howmanyrows = mysql_num_rows($howmanyrows); > >if ($howmanyrows == '0') { $auto_inc_id = '0'; } else { >$auto_inc_id = (($howmanyrows+1)); >}; > >I'm not sure if that will work, but its a start. > >-- Ben Cairns - Head Of Technical Operations >intasept.COM >Tel: 01332 365333 >Fax: 01332 346010 >E-Mail: BenC@intasept.com >Web: http://www.intasept.com > >"MAKING sense of >the INFORMATION >TECHNOLOGY age >@ WORK......" > > >-- >PHP Windows Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net >For additional commands, e-mail: php-windows-help@lists.php.net >To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.windows (#6354) next »