TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 02-05-2008, 02:46 PM   #1 (permalink)
The Contributor
 
Join Date: Jan 2008
Posts: 87
Thanks: 49
StevenF is on a distinguished road
Default 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
__________________
My Personal and Photo Blog
StevenF is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 02:40 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design