Welcome! Log In Create A New Profile

Advanced

Update SQL

Posted by 8511454 - VanZyl 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Update SQL
April 28, 2013 11:18PM
Hi,

I sent a string with GET from an HTML form page to a separate PHP file. The player-id came accross correctly(by looking at the URL). When I want to use its values to update the record in the table, it does not complain, but the the update is ignored. I also picked up, by echoeing the player-id that it add a "1" to the value. For example player_id = 4 came across via the URL but display player_id = 41 when the script runs. Any suggestions?

Language: PHP
<?PHP $db_handle = mysql_connect($server, $user_name, $password); $db_found = mysql_select_db($database, $db_handle); if ($db_found) { $SQL = "UPDATE playerinfo SET name = '$_GET[name]', surname = '$_GET[surname]', contactnumber = '$_GET[contactnumber]', email = '$_GET[email]', position = '$_GET[position]', username = '$_GET[username]', password = '$_GET[password]' WHERE player_id = '$_GET[player_id]'"; $result = mysql_query($SQL); $SQL = "SELECT * FROM player_info"; $result = mysql_query($SQL); while ($db_field = mysql_fetch_assoc($result)) { print $db_field['player_id'] "<BR>"; print $db_field['name'] "<BR>"; print $db_field['surname'] "<BR>"; print $db_field['contactnumber'] "<BR>"; print $db_field['email']"<BR>"; print $db_field['position']"<BR>"; print $db_field['username']"<BR>"; print $db_field['password']"<BR>"; } } else{   die(mysql_error());} ?>
Re: Update SQL
April 28, 2013 11:41PM
Thank you,

I have picked up my problem.

Van Zyl
Re: Update SQL
April 29, 2013 10:38PM
Hi

I have the exact same problem, and can't seem to figure it out!
Can you please help?

Thank you

Venter
Re: Update SQL
May 02, 2013 12:48PM
Hallo,

It was spaces and commas that was the problem, especially at the end of the line. Use backspaces at the beginning of a next line in the same statement. Do a print preview and carefully examine.

Good luck

Van Zyl
Sorry, only registered users may post in this forum.

Click here to login