MYSQL&sscanf Problem
#1

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.
Reply
#2

Try and do: p[Size] for example sscanf(resultEX,"p[40]|d",
Reply
#3

What do you mean? I don't have only one number, I gave you the code I use with only one parameter.
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)