garethhall Posted July 6, 2009 Share Posted July 6, 2009 I am trying to update the DB but I keep in getting the "Sorry there was an error updating the photos table" message. Funny thing is if I prevent the first update query to run then it updates the DB fine? Anyone know way it's doing that? <?php if(isset($_POST['confirm']) && isset($_GET['invID'])){ $SQLupdate = "UPDATE invoiceDetail SET dState = '1' WHERE invoiceId = $invID AND dState = '2' OR dState = '3'"; $update = mysql_query($SQLupdate, $admin); if($update){ // Update photo table and set image state $SQLph = "SELECT photoId FROM invoiceDetail WHERE invoiceId = $invID AND dState = '3'"; $rsPH = mysql_query($SQLph,$admin); while($rwPH = mysql_fetch_assoc($rsPH)){ $phID = $rwPH['photoId']; $sql_updatePH = "UPDATE photos SET saleState = '3' WHERE photoID = '$phID'"; $updatePH = mysql_query($sql_updatePH,$admin); } if($updatePH){ header("Location: ". $approveURL); }else{ echo "Sorry there was an error updating the photos table"; } }else{ echo "Sorry there was an error updating the invoice details table"; } } ?> Link to comment https://forums.phpfreaks.com/topic/164919-error-updating-db/ Share on other sites More sharing options...
Adam Posted July 6, 2009 Share Posted July 6, 2009 Use mysql_error() to find the error returned. Generally this will help you solve the problem straight away. Link to comment https://forums.phpfreaks.com/topic/164919-error-updating-db/#findComment-869648 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.