newbie - last_insert_id() with mysql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux