Jump to content

table doesn't update


funbinod

Recommended Posts

hello all!

 

i've written the following table update code

$updateq = $mysqli->prepare("UPDATE user SET address=?, phone=? WHERE uid=?");
if(!$updateq) {
	$_SESSION['err'] = "There is some error updating user info!";
	die(header("location: uman.php?uid=$userid"));
} else {
	$updateq->bind_param('sii', $addr, $phone, $userid);
	if (!$updateq->execute()) {
		$_SESSION['err'] = "There is some error executing user update!";
		die(header("location: uman.php?uid=$userid"));
	} else {
                // success
		?>
                <script>
		alert('User info updated successfully!4');
		window.opener.location.href = 'admin.php?m=man-u';
		window.close();
		</script>
                <?php
		}
	}
}

this generates the success alert but the table doesn't get updated. can anyone please point towards my mistake??

 

thanks in advance..

Link to comment
Share on other sites

It says that the query was executed successfully, so if it didn't update the database then the where clause didn't match any records, the data was the same, you're not using the correct database, etc. It's not a problem with the code.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...