newbie - last_insert_id() with mysql
| From: | Max Clark | Date: | Thu, 12 Dec 2002 17:39:34 +0000 |
| Subject: | newbie - last_insert_id() with mysql | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-24095@lists.php.net to get a copy of this message | ||
Hi-
I am trying to insert information into mysql based with the sql queries
below. When I run this insert from the mysql console everything works
correct, however, when I run this through php the second sql query doesn't
execute (I'm assuming there is a problem with the last_insert_id()).
I have tried changing the "last_insert_id()" to a "mysql_insert_id()"
function with no success?
How do I get this to work?
Thanks in advance,
Max
$sql1 = "insert into transport (domain,transport) values
('$domain','$transport')";
$sql2 = "insert into acl (adminId,transportId,securityId) values
('$userid',last_insert_id(),'1'";
mysql_query($sql1);
mysql_query($sql2);