funbinod Posted March 7, 2016 Share Posted March 7, 2016 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 More sharing options...
justsomeguy Posted March 7, 2016 Share Posted March 7, 2016 Maybe the user ID doesn't exist, or maybe the types aren't correct. Did you really store a phone number as an integer? Link to comment Share on other sites More sharing options...
funbinod Posted March 8, 2016 Author Share Posted March 8, 2016 both are correct. types are also defined as [ INT(1) ] and phone number as [ INT(15) ] Link to comment Share on other sites More sharing options...
justsomeguy Posted March 8, 2016 Share Posted March 8, 2016 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now