Raised This Month: $51 Target: $400
 12% 

PHP Mysql Update


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
shuttle_wave
Veteran Member
Join Date: Apr 2009
Location: New Zealand
Old 01-01-2011 , 23:22   PHP Mysql Update
Reply With Quote #1

this code doesnt seem to update the status colum where steam id =...

PHP Code:
    if ($matches[1] == "Successful")
    {
        
mysql_select_db(SQL_DB$sql_conn);
        
mysql_query("UPDATE inviter SET Status = 'INVITED'
WHERE Steamid = '%s';"
$invite_steam_id);
    } 
__________________
JailBreak Mod with Plugin API ( 90% ) Public
shuttle_wave is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 01-01-2011 , 23:25   Re: PHP Mysql Update
Reply With Quote #2

PHP Code:
    if ($matches[1] == "Successful")
    {
        
mysql_select_db(SQL_DB$sql_conn);
        
mysql_query(sprintf("UPDATE inviter SET Status = 'INVITED'
WHERE Steamid = '%s';"
$invite_steam_id));
    } 
__________________
joaquimandrade is offline
lynettekecds
New Member
Join Date: Feb 2011
Old 02-25-2011 , 17:29   Re: PHP Mysql Update
Reply With Quote #3

Quote:
Originally Posted by joaquimandrade View Post

Code:
    if ($matches[1] == "Successful")
    {
        mysql_select_db(SQL_DB, $sql_conn);
        mysql_query(sprintf("UPDATE inviter SET Status = 'INVITED'
WHERE Steamid = '%s';", $invite_steam_id));
    }
[/code]
I do not fully understand the sample, Could you give more details? Would you pls offer the related documentation?
lynettekecds is offline
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 02-27-2011 , 01:40   Re: PHP Mysql Update
Reply With Quote #4

Quote:
Originally Posted by lynettekecds View Post
I do not fully understand the sample, Could you give more details? Would you pls offer the related documentation?
http://linux.die.net/man/3/sprintf
Seta00 is offline
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 03-01-2011 , 13:50   Re: PHP Mysql Update
Reply With Quote #5

Most people don't use string formating in php, why not sure, it's just not that common. Most people just do something like

"UPDATE inviter SET Status = 'INVITED'
WHERE Steamid = '". mysql_real_string_escape($var) . "'"

Remember to use mysql_real_string_escape on ANY variable RIGHT before it gets inserted! Otherwise you can be vulnerable to sql injections. Writing a small class to handle all db interactions is probably a good idea.
Styles is offline
Send a message via AIM to Styles
Reply



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:32.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode