MYSQL&sscanf Problem - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: MYSQL&sscanf Problem (
/showthread.php?tid=160170)
MYSQL&sscanf Problem -
Kyleee - 15.07.2010
Hello there. I have a problem with sscanf(v2) and MYSQL. When I use something like that:
Code:
format(queryEX,512,"SELECT `Bank` FROM `players` WHERE `id`='%d'",PlayerInfo[playerid][pSQLID]);
mysql_query(queryEX);
mysql_store_result();
mysql_fetch_row_format(resultEX,"|");
mysql_free_result();
sscanf(resultEX,"p|d",
PlayerInfo[playerid][pBank]); // 58d
I don't know why my code does not work when I remove that
P| or change it to p<>> (as I was told), that does not work at all, I can't get values when I remove the P. It also gives me an error;
Code:
sscanf warning: string without a length are deprecated, please add a destination size.
But it works.
Re: MYSQL&sscanf Problem -
oliverrud - 15.07.2010
Try and do: p[Size] for example sscanf(resultEX,"p[40]|d",
Re: MYSQL&sscanf Problem -
Kyleee - 16.07.2010
What do you mean? I don't have only one number, I gave you the code I use with only one parameter.
Re: MYSQL&sscanf Problem -
Kyleee - 17.07.2010
This is the code I use for the houses, but it happens with any code..
Code:
mysql_query("SELECT `id`,`x`,`y`,`z` FROM `houses` WHERE `price`='0'");
mysql_store_result();
if(mysql_num_rows())
{
new pid;
while(mysql_fetch_row(resultEX)){
sscanf(resultEX, "p|dfff",intEX,xEX,yEX,zEX);
pid=CreatePickup(INFO_PICKUP,1,xEX,yEX,zEX);
format(String,256,"UPDATE `houses` SET `pid`='%d' WHERE `id`='%d'",pid,intEX);
mysql_query(String);
}
}
mysql_free_result();
As you can see I always add the p| thing, even though it gives me an error.. because I can't use it.
The pawno compiles it, but when I start my server I can't see the icons (in this case) and can't access the database.