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

Solved SQL Syntax Check


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SkinnyBruv
AlliedModders Donor
Join Date: Feb 2013
Location: Straya
Old 10-01-2016 , 02:33   SQL Syntax Check
Reply With Quote #1

Code:
Format(query, sizeof(query), "UPDATE '%s' SET name='%s' WHERE steamid='%s'", tablePlayer, username, SID);
		//SQL_FastQuery(dbConn, query);
		SQL_TQuery(dbConn, SQL_dbDoNothing1, query);	// Send the Information off to the MySQL Database
Howdy guys, this has been driving me nuts!
Can you please check if my SQL Syntax is correct? i keep getting the error:
You have an error in your SQL syntax: check the manual that corresponds to your MariaDB server version for the right syntax to use near ''fngls' SET name='SkinnyBruv' WHERE steamid="SID" at line 1
__________________
www.ancientgaming.net is my story.
Everything happens for a reason.
Nothing is random...
#Do you even AGN...

Last edited by SkinnyBruv; 10-01-2016 at 04:18.
SkinnyBruv is offline
Send a message via Skype™ to SkinnyBruv
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 10-01-2016 , 02:53   Re: SQL Syntax Check
Reply With Quote #2

Code:
FormatEx(query, sizeof(query), "UPDATE %s SET name='%s' WHERE steamid='%s'", tablePlayer, username, SID);
try this
__________________
retired
shavit is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 10-01-2016 , 02:53   Re: SQL Syntax Check
Reply With Quote #3

Code:
UPDATE `%s` SET name='%s' WHERE steamid='%s'
Quote:
Originally Posted by shavit View Post
Code:
FormatEx(query, sizeof(query), "UPDATE %s SET name='%s' WHERE steamid='%s'", tablePlayer, username, SID);
try this
Shanked

Last edited by Drixevel; 10-01-2016 at 02:55.
Drixevel is offline
SkinnyBruv
AlliedModders Donor
Join Date: Feb 2013
Location: Straya
Old 10-01-2016 , 03:09   Re: SQL Syntax Check
Reply With Quote #4

Whats difference between FormatEx and Format?

Cheers btw

Still got same problem

Same here:

Code:
stock bool SetTargetVIP(any:target)
{
	new String:query[255];
	new String:SID[70];
	
	GetClientAuthId(target, AuthId_Steam3, SID, sizeof(SID));
	GetConVarTable(TABLE_PLAYER);
	
	FormatEx(query, sizeof(query),  "UPDATE '%s' SET vip='0' WHERE steamid='%s'", tablePlayer, SID);//Gets GangCount (or largest gang id)
	//SQL_FastQuery(dbConn, query);
	SQL_TQuery(dbConn, SQL_dbDoNothing, query, target, DBPrio_High);
}
__________________
www.ancientgaming.net is my story.
Everything happens for a reason.
Nothing is random...
#Do you even AGN...

Last edited by SkinnyBruv; 10-01-2016 at 03:12.
SkinnyBruv is offline
Send a message via Skype™ to SkinnyBruv
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 10-01-2016 , 03:13   Re: SQL Syntax Check
Reply With Quote #5

It's not about the Format native used but about you putting quotes around the table name.

From the docs for FormatEx:
Quote:
This is the same as Format(), except none of the input buffers can overlap the same memory as the output buffer. Since this security check is removed, it is slightly faster.
__________________
Peace-Maker is offline
SkinnyBruv
AlliedModders Donor
Join Date: Feb 2013
Location: Straya
Old 10-01-2016 , 03:23   Re: SQL Syntax Check
Reply With Quote #6

Quote:
Originally Posted by Peace-Maker View Post
It's not about the Format native used but about you putting quotes around the table name.

From the docs for FormatEx:
Yeah it was

Soo to fix, just remove the '%s' to %s

Holy shit that took me like fucking 4 days to figure out

Your the best man <3 +Rep
__________________
www.ancientgaming.net is my story.
Everything happens for a reason.
Nothing is random...
#Do you even AGN...
SkinnyBruv is offline
Send a message via Skype™ to SkinnyBruv
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 10-01-2016 , 04:53   Re: SQL Syntax Check
Reply With Quote #7

Quote:
Originally Posted by SkinnyBruv View Post
just remove the '%s' to %s
You probably want to use
Code:
`%s`
instead like redwerewolf suggested.
__________________

Last edited by Impact123; 10-01-2016 at 04:59.
Impact123 is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 10-01-2016 , 06:18   Re: SQL Syntax Check
Reply With Quote #8

Quote:
Originally Posted by Impact123 View Post
You probably want to use
Code:
`%s`
instead like redwerewolf suggested.
there's no difference unless the user can manipulate the table name (should NEVER happen)
__________________
retired
shavit is offline
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 17:10.


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