Alright.
i have a db that holds item information of movies and dvds.
after i successfully add a new item, i'm directed to a upload.php page which would upload an image with the current ID of the item i just added to the db.
so if the item is just added is itemID = 223, the image, after uploading would be 223.jpg
my problem is that I'm not sure what is the best way to get the current itemID i'm working with without creating a new query that says "select itemID From Items Limit -1". I say this because just in case another person is also adding an Item, then that would/might cause confusion.
on top of that, the current code i have does not pass the value of $II to the next page, which i believe has to do with the query itself.
formProcess.php
if($form_action == "Add New Item"){
// addItem -> addItemResponse.php
$ItemCost = preg_replace( "[^0-9.]", "", $ItemCost);
// $ShippingCost =preg_replace( "[^0-9.]", "", $ShippingCost);
$strSQL = "INSERT INTO Items (ItemSKU, ItemName, ItemDescription, ItemCost, Category, available, year, country, librarycongress, genre, rated, director, format, ebert_link) VALUES(
'$ItemSKU',
'$ItemName',
'$ItemDescription',
'$ItemCost',
'$Category',
'$available',
'$year',
'$coutry',
'$loc',
'$genre',
'$rated',
'$director',
'$format',
'$ebert_link')";
// my problem is here with $result, i'm sure. until end.
$result = mysql_query($strSQL,$dbServerConn);
while ($row = mysql_fetch_row($result)) {
$II=$row['itemID'];
}
Header("Location:".RELATIVE_URL."/admin/upload.php?II=$II");
}
now when i get to upload.php all i see is
domain.com/admin/upload.php?II=
so when i upload an image its '.jpg'. actully, i don't get anything.
upload.php // some of it
// form stuff ENCTYPE="multipart/form-data
<input type="hidden" name="itemID" value="$II">
<input name=\"image\" type=\"file\">
// end form stuff
uploadProcess.php
if($form_action == "Upload Item"){
//echo "Image: $image | ItemID: $ItemID ";
exec("mv $image '".WEBROOT."/images/".$ItemID.".jpg'");
Header("Location:".RELATIVE_URL."/admin/");
}
this might be more than you need. Thanks for any help.