SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 06/02/2013, 08:23 AM   #1
wilko1995
Big Clucker
 
Join Date: Dec 2010
Posts: 73
Reputation: 0
Default MYSQL Help Error

Code:
GetPlayerName(playerid, Name, sizeof(Name));
mysql_query("SELECT `password` FROM `player` WHERE `username`=`%s`", Name);
Code:
H:\RP\filterscripts\msql.pwn(218) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase
Hello,

I would like to know what i have done incorrectly in this code to result in the error

Thanks
wilko1995 is offline   Reply With Quote
Old 06/02/2013, 08:26 AM   #2
3ventic
Huge Clucker
 
3ventic's Avatar
 
Join Date: Jun 2009
Location: Finland
Posts: 317
Reputation: 70
Default Re: MYSQL Help Error

You cannot use mysql_query like you use format. You need to use format() to format a string first, and then mysql_query(the string you formatted).
__________________
Follow me on *******
3ventic is offline   Reply With Quote
Old 06/02/2013, 08:28 AM   #3
wilko1995
Big Clucker
 
Join Date: Dec 2010
Posts: 73
Reputation: 0
Default Re: MYSQL Help Error

so like
Code:
format(str, sizeof(str), "SELECT `password` FROM `player` WHERE `username` = `%s`", Name);
mysql_query(str);
thanks
wilko1995 is offline   Reply With Quote
Old 06/02/2013, 09:45 AM   #4
Kirollos
Gangsta
 
Kirollos's Avatar
 
Join Date: Jun 2010
Location: Cairo, Egypt
Posts: 566
Reputation: 83
Default Re: MYSQL Help Error

Quote:
Originally Posted by wilko1995 View Post
so like
Code:
format(str, sizeof(str), "SELECT `password` FROM `player` WHERE `username` = `%s`", Name);
mysql_query(str);
thanks
Exactly,

but here in WHERE `username` = `%s`

it should be WHERE `username` = '%s'
__________________
My github profile: https://github.com/Kirollos/

( ͡ ͜ʖ ͡)
Kirollos is offline   Reply With Quote
Reply

Thread Tools
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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mysql Error using the Mysql 2.1.1 Plugin yvoms Scripting Help 2 07/06/2013 10:48 PM
Mysql Error: 1064 You have an error in your SQL syntax Robert_Crawford Scripting Help 2 26/10/2012 02:39 AM
MySQL Error SomebodyAndMe Scripting Help 11 31/05/2012 02:48 PM
MySQL Error (In the MySQL log) Unknown123 Help Archive 10 28/02/2011 10:24 PM


All times are GMT. The time now is 10:26 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.