From the responses in this thread:
http://www.vbforums.com/showthread.php?t=513904

I'm doing a simple script for someone adding banners to their site:
id
banner_type
file_name
'etc...

I want the file_name to always be unique. So I will append the id field to the beginning of the file name. But I won't know the ID until I have inserted the new record.

What's the best way to do this? Insert the record with a blank file_name field, then use the mysql_insert_id() and then update that record after?

A real quick example of what I'm talking about:
PHP Code:
<?php
  
// Insert the record.
  
mysql_query("INSERT into banners (id,banner_type,file_name,url,alt_text) VALUES
  (NULL,'1','','www.something.com','Visit something.com!')"
);
  
  
// Get ID of last insert.
  
$insert_id mysql_insert_id($dbc); //<- $dbc is current connection value.
  
  // Get unique file name.
  
$fname $insert_id "_$actual_file_name";
  
  
// Update record.
  
mysql_query("UPDATE banners SET file_name='$fname' WHERE id='$insert_id' LIMIT 1");
?>
Is this the correct way to do it?