> mysql_insert_id() is a PHP function, not a MYSQL function.  You are also
> missing a close quote on your insert string.  So you have to do it like
> this:

Correct, but LAST_INSERT_ID() is a MySQL function.... which is what he's

> $sql2 = "insert into acl (adminId,transportId,securityId) values

So, no, you're trying to use a MySQL function here in PHP code. The original
syntax was correct.

> $lastid = mysql_insert_id();
> $sql2 = "insert into acl (adminId,transportId,securityId) values
> which is the same as:
> $lastid = mysql_insert_id();
> $sql2 = "insert into acl (adminId,transportId,securityId) values

Both of those are correct, too, if you want to use the PHP function.

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

You're missing a closing paranthesis on the end of the second SQL statement.
That is probably what's causing your error. In the future, use mysql_error()
to find out why it's failing...

mysql_query($query) or die("Error in $query: " . mysql_error());

---John Holmes...

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

Reply via email to