...

View Full Version : cannot update



dea
01-31-2007, 05:11 AM
attn: memb_id is primary key and indicate member's email address.

In the middle coding i also insert those data need to be update.

Below are the code most suspect:

$query="UPDATE member SET
username='{$_POST['username']}', password='{$_POST['password']}',
phone_no='{$_POST['phone_no']}',
month='{$_POST['month']}',
day='{$_POST['day']}',
year='{$_POST['year']}',
WHERE memb_id='{$_POST['memb_id']}' ";

if(is_numeric($_GET['memb_id'])){

$query="SELECT * FROM member WHERE memb_id={$_GET['memb_id']}";

if($r=mysql_query($query)){

$row=mysql_fetch_array($r);

echo "<form action='editProfile.php' method='POST'>

<input type='hidden' name='memb_id' value=".$_GET['memb_id'].">
<input type='submit' name='save' value='Save'>
<input type='submit' name='cancel' value='Cancel'>

}else{
print 'Could not retrieve the record because:<b>'.mysql_error().'</b>. </p>';
}


}

else{
print'<p><b>You must have made a mistake in using this page.</b></p>';
}

koyama
01-31-2007, 01:24 PM
Looks like there is a comma that shouldn't be there:


$query="UPDATE member SET
username='{$_POST['username']}', password='{$_POST['password']}',
phone_no='{$_POST['phone_no']}',
month='{$_POST['month']}',
day='{$_POST['day']}',
year='{$_POST['year']}', <<<----
WHERE memb_id='{$_POST['memb_id']}' ";

What error message do you get?

Mhtml
01-31-2007, 03:15 PM
Good thing to keep in mind too, is always dump your $query so you can examine what's being put in it... Half the time you'll find you've forgotten something or passed the wrong value.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum