MySQL Error - 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: MySQL Error (
/showthread.php?tid=365002)
MySQL Error -
ProjectGANTON - 01.08.2012
PHP код:
stock ReadConf()
{
new query[356],line[1050];
format(query, sizeof(query), "SELECT * FROM `chest` WHERE `id` = '1'");
mysql_query(query);
mysql_store_result();
mysql_fetch_row(line);
new fetch[90];
mysql_get_field("ownerid", fetch);
printf("%d",fetch);
return 1;
}
main()
{
ReadConf();
}
But it print "0", and ownerid is 5.
Help please.
Re: MySQL Error -
iggy1 - 01.08.2012
If your using version R7 of BlueG' plugin your query will not work, because all queries MUST be threaded.
Here is a thread that will help you convert
if you are using version R7.
Re: MySQL Error -
ProjectGANTON - 01.08.2012
I'm using this:
/*
SA-MP MySQL plugin R5
Copyright © 2008-2010, G-sTyLeZzZ
*/
And query works fine because i got a "ReadUser" that's working fine.
Re: MySQL Error -
Vince - 01.08.2012
And if you're not, then the problem is because you're trying to display a string as an integer which obviously won't work.
pawn Код:
mysql_get_field("ownerid", fetch);
printf("%d",strval(fetch));
Re: MySQL Error -
ProjectGANTON - 01.08.2012
ownerid is an integer.
Re: MySQL Error -
Vince - 01.08.2012

It's still returned as string by mysql_fetch_field, hence strval.
Re: MySQL Error -
ProjectGANTON - 01.08.2012
Ill try.
Re: MySQL Error -
ProjectGANTON - 01.08.2012
It print 0, when ownerid is 5.
Ok, i'm an idiot.
The problem was because i wrote owenerid on mysql table, lol sorry guys.