02-05-2008, 02:46 PM
|
#1 (permalink)
|
|
The Contributor
Join Date: Jan 2008
Posts: 87
Thanks: 49
|
Updating A Database
Hello,
I've been messing around with this query for a while now and can't get it to work as intended!
Code:
$query = 'UPDATE althlete SET
athlete = "'.mysql_real_escape_string($ud_name).'",
regno = "'.mysql_real_escape_string($ud_regno).'",
gender = "'.mysql_real_escape_string($ud_gender).'",
age = "'.mysql_real_escape_string($ud_age).'",
eventno = "'.mysql_real_escape_string($ud_eventno).'",
distance = "'.mysql_real_escape_string($ud_distance).'",
stroke = "'.mysql_real_escape_string($ud_stroke).'",
time = "'.mysql_real_escape_string($time).'",
place = "'.mysql_real_escape_string($place).'",
WHERE athlete_number = $ud_athletenumber';
Basically, I have a database which holds data on swimmers. There is a field called athlete_number which is an Autonumber. I want to update the row where numbers match, but it doesn't seem to do anything. If I take the last line away, then every row in the table gets replaced with the data entered. So it's something to do with the last line.
Edit: $ud_athletenumber is a hidden form field which contains the autonumber.
Any help appreciated.
- Steven
|
|
|
|