SA-MP Forums Archive
help mysql - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: help mysql (/showthread.php?tid=583082)



help mysql - Jimmi - 25.07.2015

C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(5487) : error 017: undefined symbol "mysql_store_result"
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(548 : error 017: undefined symbol "mysql_num_rows"
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(5496) : error 017: undefined symbol "mysql_free_result"

Code:
	new qstr[100];
	format(qstr,100,"SELECT * FROM `players` WHERE `username`='%s';",plname);
	mysql_query (qstr);
	mysql_store_result();
	if(mysql_num_rows() != 0)
	{
		gPlayerAccount[playerid] = 1;
	}
	else
	{
		gPlayerAccount[playerid] = 0;
	}
	mysql_free_result();
	return 1;
}
use mysql r39-3


Re: help mysql - Jimmi - 25.07.2015

upppp


Re: help mysql - TheSkyBlueTeam - 25.07.2015

Quote:
Originally Posted by Jimmi
View Post
upppp
define it?


AW: help mysql - Mencent - 25.07.2015

Hello!

PHP Code:
new qstr[100];
mysql_format(handle,qstr,sizeof qstr,"SELECT * FROM `players` WHERE `username`='%e';",plname);
mysql_tquery(handle,qstr,"OnLoadPlayer","i",playerid);//handle is the connection handle, please adjust this
//at the end of the script:
forward OnLoadPlayer(playerid);
public 
OnLoadPlayer(playerid)
{
    if(!
cache_num_rows())return 1;
    
gPlayerAccount[playerid] = 1;
    return 
1;

Notice:
Quote:

//handle is the connection handle, please adjust this

- Mencent


Re: AW: help mysql - J0sh... - 25.07.2015

Quote:
Originally Posted by Mencent
View Post
Hello!

PHP Code:
new qstr[100];
format(qstr,sizeof qstr,"SELECT * FROM `players` WHERE `username`='%s';",plname);
mysql_tquery(handle,qstr,"OnLoadPlayer","i",playerid);//handle is the connection handle, please adjust this
//at the end of the script:
forward OnLoadPlayer(playerid);
public 
OnLoadPlayer(playerid)
{
    if(!
cache_num_rows())return 1;
    
gPlayerAccount[playerid] = 1;
    return 
1;

Notice:


- Mencent
Use this, but replace Username='%s' with Username='%e' and replace format with mysql_format(handle, qstr