Jump to content

Error updating DB


garethhall

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.