<?php require_once('Connections/db.php'); ?>
<?php
mysql_select_db($database_db, $db);
$query_rsGetNextID = "SELECT information_schema.`TABLES`.AUTO_INCREMENT FROM information_schema.`TABLES` WHERE information_schema.`TABLES`.TABLE_NAME = 'dbImages'";
$rsGetNextID = mysql_query($query_rsGetNextID, $db) or die(mysql_error());
$row_rsGetNextID = mysql_fetch_assoc($rsGetNextID);
$totalRows_rsGetNextID = mysql_num_rows($rsGetNextID);
// This is your next available ID for dbImages
$myNextID = $row_rsGetNextID['AUTO_INCREMENT'];
mysql_free_result($rsGetNextID);
?>
You have to replace dbImages (my table name) with your table name
As i said if this is a multi user environment you can not be sure that this is YOUR next ID.
Another user can insert a record and the next available ID change.
Better use Data Bridge to
1. Add a new record, Data bridge ask you for the session name for "Save Inserted ID in Session" - dbImagesInsertID for example
2. Insert file upload and use in file name my_file_name_<?php echo $_SESSION['dbImagesInsertID']; ?>
3. Update the record with imagename/filename/... using informations from the upload object in bindings panel
You can do this all in the same page.