Jump to content

[SOLVED] Update Issues


xfire

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.