RE: [PHP-DB] auto_increment in mysql
| From: | Ben Cairns | Date: | Wed, 28 Mar 2001 10:50:06 +0000 |
| Subject: | RE: [PHP-DB] auto_increment in mysql | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-6353@lists.php.net to get a copy of this message | ||
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......"