PEAR: nextID() mysql

From: Date: Mon, 19 Nov 2001 18:34:09 +0000
Subject: PEAR: nextID() mysql
Groups: php.general 
Request: Send a blank email to php-general+get-75131@lists.php.net to get a copy of this message
My ignorance with databases will probably show here, but I haven't been able to solve this myself so I thought I'd post. I'm working on converting a DB driven site using mysql specific commands to the PEAR DB method. One of the fields I have in my mysql database is a auto_increment primary key (will show below). On my php script I used to use mysql_insert_id to get the id (number) of my last insert so I can pass this to the next page (multiple tables). When I tried to use nextID(), it kept creating "_seq" tables in my DB depending on what I specified as the sequence(argument). This causes a problem because it returns 1, because there's nothing previously in _seq table. The real _seq or auto_increment is in my table chamber(described below). My question is: is there anyway to make nextID() use the id/auto_increment in the table I've setup previously and have id/data in rather than having it create _seq and rewrite all of my code?? Hope I'm clear. If not drop me an e-mail. Thanks Chris D. mysql> describe chamber; +--------------+----------------------+------+-----+---------+----------------+
| Field        | Type                 | Null | Key | Default | Extra       |
+--------------+----------------------+------+-----+---------+----------------+
| id           | smallint(5) unsigned |      | PRI | NULL    | auto_increment |
| company      | varchar(255)         | YES  |     | NULL    |       |
| contact_name | varchar(100)         | YES  |     | NULL    |       |
| address      | varchar(100)         | YES  |     | NULL    |       |
| city         | varchar(75)          | YES  |     | NULL    |       |
| state        | varchar(50)          | YES  |     | NULL    |       |
| phone        | varchar(100)         | YES  |     | NULL    |       |
| fax          | varchar(100)         | YES  |     | NULL    |       |
| category     | varchar(100)         | YES  |     | NULL    |       |
| email        | varchar(100)         | YES  |     | NULL    |       |
| company_url  | varchar(255)         | YES  |     | NULL    |       |
| ad_url       | varchar(255)         | YES  |     | NULL    |       |
+--------------+----------------------+------+-----+---------+----------------+ 12 rows in set (0.00 sec)

« previous php.general (#75131) next »