xfire Posted March 12, 2007 Share Posted March 12, 2007 Hi all, I am having some trouble with an update script. I am running PHP 4.4.4 and MySQL 4.1. Here is my update script: include("dbconn.php"); if($_POST['form_submit'] == "true") { $ind_fname = ucfirst(strtolower($_POST['ind_fname'])); $ind_lname = ucfirst(strtolower($_POST['ind_lname'])); $ind_company = $_POST['ind_company']; $ind_title = $_POST['ind_title']; $ind_phone = $_POST['ind_phone']; $ind_email = strtolower($_POST['ind_email']); $ind_fax = $_POST['ind_fax']; $ind_other = $_POST['ind_other']; //Updates contact info into member table $insert_contact = "UPDATE CONTACTS SET ind_fname = '$ind_fname', ind_lname = '$ind_lname', ind_company = '$ind_company', ind_title = '$ind_title', ind_phone = '$ind_phone', ind_email = '$ind_email', ind_fax = '$ind_fax', ind_other = '$ind_other' WHERE ind_id = '$ind_id'"; $result_insert = mysql_query($insert_contact, $connect) or die(mysql_error()); $confirmMsg = "<div class=redText>$_POST[ind_fname] $_POST[ind_lname], was updated in the database.</div>"; $errorMsg = " "; } //End if form_submit == true else { $confirmMsg = " "; $errorMsg = " "; } //End else It gets the ind_id from a previous page that posts the ID number for that row to be edited. Every time I try and edit a row it says the row has been updated (no errors), but it doesn't actually save the update. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/42398-solved-update-issues/ Share on other sites More sharing options...
fenway Posted March 13, 2007 Share Posted March 13, 2007 Post the interpolated query produced by PHP (without variables)... my guess is that it's the wrong ID. Quote Link to comment https://forums.phpfreaks.com/topic/42398-solved-update-issues/#findComment-205956 Share on other sites More sharing options...
xfire Posted March 13, 2007 Author Share Posted March 13, 2007 Okay, that helped A LOT. I can't believe I missed that. I had nothing in the PHP script that got the ID number from the previous page. I can't believe I missed that. I guess I had just been looking at it for far to long. Amazing what a simple line such as: $ind_id = $_GET['ind_id']; can do. Thanks for pointing me in the correct direction. AKA: Solved. Quote Link to comment https://forums.phpfreaks.com/topic/42398-solved-update-issues/#findComment-205998 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.