//first LAST_INSERT_ID()
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "for_salePostForm")) {
$insertSQL = sprintf("INSERT INTO classifieds (CategoryID, TypeID, UserID, Title, `Description`, Location) VALUES (%s, %s, LAST_INSERT_ID(), %s, %s, %s)",
GetSQLValueString($_POST['CategoryID'], "int"),
GetSQLValueString($_GET['TypeID'], "int"),
GetSQLValueString($_POST['Title'], "text"),
GetSQLValueString($_POST['Description'], "text"),
GetSQLValueString($_POST['Location'], "text"));
//second LAST_INSERT_ID()
$insertSQL = sprintf("INSERT INTO images (ClassifiedsID, filename, mimetype, image, filesize) VALUES (LAST_INSERT_ID(), %s, %s, %s, %s)",
GetSQLValueString($_POST['filename'], "text"),
GetSQLValueString($_POST['mimetype'], "text"),
GetSQLValueString($_POST['image'], "text"),
GetSQLValueString($_POST['filesize'], "int"));
|