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