PDA

View Full Version : Can't update one field in database


bddotnet
1-16-09, 10:39 PM
I have a database where the admin user can update information.

The form says:


<input type="text" name="ud_lastname" value="' . $row->last_name . '" id="ud_lastname">


The update code says:


//update information
$sql = "UPDATE membership09 SET ID='$ud_ID', last_name='$ud_lastname', first_name='$ud_firstname', address='$ud_address', city='$ud_city', state='$ud_state', zip='$ud_zip', phone='$ud_phone', additional='$ud_additional', email='$ud_email', membershipyr='$ud_membershipyr', new_member='$ud_newmember', type='$ud_type', amount='$ud_amount', received='$ud_received', directory='$ud_directory' WHERE last_name = '$ud_lastname' LIMIT 1";


Every field in the field list will update except last_name. I have checked the database table to make sure the field name is correct and still not able to update THAT field.

What am I missing?

HalfaBee
1-16-09, 11:16 PM
The where matches last_name, so how can you change it?

entrecon
1-16-09, 11:38 PM
Can you update the field in MySQL?

HalfaBee
1-17-09, 12:38 AM
Bobby should be matching the id not the last_name.

bddotnet
1-19-09, 06:42 PM
Wow! I changed it to WHERE $ID = '$ud_ID' on the UPDATE statement and it works great! Thanks guys! I completely missed that!