psychowolvesbane Posted February 1, 2008 Share Posted February 1, 2008 I have a form with a an image upload, I want it so the move_uploaded_files() script occurs after the SQL query has successfully been completed, however the way I have tried to do this does not work, but works fine if I don't restrict it to a successful query, here's my code for that part of the form. Also take it that the variables and their contents are correct. ... $conn = mysql_connect($Host,$Username,$Password) or die(mysql_error()); $db = mysql_select_db($Dbname, $conn); $sqlNew = "INSERT INTO Clothing (ClothingCode,Description,ItemType,Price,NUSPrice,AvailableSizes,AvailableColours) VALUES('$ClothingCode','$Description','$ItemType','$Price','$NUSPrice','$AvailableSizes','$AvailableColours')"; $rsNew = mysql_query($sqlNew,$conn)or die('Problem with query: ' . $sqlNew . '<br />' . mysql_error()); if(mysql_affected_rows($conn) == "1") { $move_image = move_uploaded_file($image_temp, $dirupload.$ClothingCode.".jpg"); // <--- This is the culprit $Added = true; $NotExec = false; } elseif(mysql_affected_rows($conn) =="0") { $Added = false; $NotExec = true; ?> <div style="position:Relative; top:250px; left:200px; width:550px"> <span class="errmsg">Could not be added, <?php echo "$ClothingCode";?> may already exist!</span> </div> <?php } mysql_close($conn); ... Can anyone see what I'm doing wrong? Quote Link to comment https://forums.phpfreaks.com/topic/88821-move_uploaded_files-help/ Share on other sites More sharing options...
psychowolvesbane Posted February 1, 2008 Author Share Posted February 1, 2008 Anyone? Quote Link to comment https://forums.phpfreaks.com/topic/88821-move_uploaded_files-help/#findComment-455206 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.