MySQL help
#1

I'm trying to setup a MySQL script and I am getting 1 error currently.

Код:
C:\X\X\X\X\X\X(48) : error 035: argument type mismatch (argument 1)
Код:
public OnPlayerConnect(playerid)
{
	new Query[80],pName[24],string[164];
	GetPlayerName(playerid,pName,24);
	format(Query,sizeof(Query),"SELECT `Username` FROM `Users` WHERE `Username` = '%s' LIMIT 1;",pName);
	mysql_query(Query);
	mysql_store_result();
	if(mysql_num_rows() != 0)//if number of rows is different from 0 then continue
	{
		format(string,sizeof(string),"Hey, %s! \nYour account is registered.\nPlease enter the password to log in!",pName);
		ShowPlayerDialog(playerid,0,DIALOG_STYLE_INPUT,"Lo g in",string,"Login","");
	}
	else
	{
		format(string,sizeof(string),"Hey, %s! \nYour account is not registered. \nPlease register to continue!",pName);
		ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Re gister",string,"Register","");
	}
	mysql_free_result();
	return 1;
}
This is the line 48
Код:
(48)mysql_query(Query);
Reply
#2

Help please?
Reply
#3

I think you should try a bigger string.
Reply
#4

Quote:
Originally Posted by matyi10012
Посмотреть сообщение
I think you should try a bigger string.
What do you mean by try a bigger string?
Reply
#5

PHP код:
format(Query,sizeof(Query),"SELECT `Username` FROM `Users` WHERE `Username` = '%s' LIMIT 1;",pName); 
to

PHP код:
format(Query,sizeof(Query),"SELECT `Username` FROM `Users` WHERE `Username` = '%s' LIMIT 1",pName); 
removed ; after LIMIT 1
Reply
#6

Quote:
Originally Posted by HardRock
Посмотреть сообщение
PHP код:
format(Query,sizeof(Query),"SELECT `Username` FROM `Users` WHERE `Username` = '%s' LIMIT 1;",pName); 
to

PHP код:
format(Query,sizeof(Query),"SELECT `Username` FROM `Users` WHERE `Username` = '%s' LIMIT 1",pName); 
removed ; after LIMIT 1
I did that still getting an error.
Reply
#7

Quote:
Originally Posted by jstowe96
Посмотреть сообщение
What do you mean by try a bigger string?
He means to increase the size of the placeholders, for an example Query[80] to [124] or [256].
Reply
#8

Quote:
Originally Posted by Wizzy951
Посмотреть сообщение
He means to increase the size of the placeholders, for an example Query[80] to [124] or [256].
That did not work either.
Reply
#9

I noticed another thing - GetPlayerName(playerid,pName,24); What is this 24 about ? Change it to GetPlayerName(playerid,pName); and tell me the result please.
Reply
#10

Alright I added that, and I have 4 errors now.
Line 47 is

Код:
format(Query,sizeof(Query),"SELECT `Username` FROM `Users` WHERE `Username` = '%s' LIMIT 1;",pName(playerid));
C:\X\X\X\X\X\X(47) : error 012: invalid function call, not a valid address
C:\X\X\X\X\X\X(47) : warning 215: expression has no effect
C:\X\X\X\X\X\X(47) : error 001: expected token: ";", but found ")"
C:\X\X\X\X\X\X(47) : error 029: invalid expression, assumed zero
C:\X\X\X\X\X\X(47) : fatal error 107: too many error messages on one line
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)