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
https://forums.phpfreaks.com/topic/42398-solved-update-issues/
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
https://forums.phpfreaks.com/topic/42398-solved-update-issues/#findComment-205998
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.