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 <[EMAIL PROTECTED]>
To: Fai <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
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: [EMAIL PROTECTED]
>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: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to