Help with mysql_query and INSERT INTO

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

 



I need to insert a new record into a MySQL table which has an auto_increment 
field Ref as the primary index.  When I have inserted the new record, I need 
to get the new Ref value in order to name some files to relate to the 
record.  At the moment I have to do a SELECT command and search for another 
field (Title) which might not be unique.

Is there another way that I get the Ref back after an INSERT?

When I use mysql_query with INSERT INTO it only returns true or false, 
rather than the row.  The PHP manual says:

Return Values
For SELECT, SHOW, DESCRIBE or EXPLAIN statements, mysql_query() returns a 
resource on success, or FALSE on error.
For other type of SQL statements, UPDATE, DELETE, DROP, etc, mysql_query() 
returns TRUE on success or FALSE on error.

Regards
Colin Davis

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux