MySQL Error
#1

PHP код:
stock ReadConf()
{
        new 
query[356],line[1050];
        
format(querysizeof(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.
Reply
#2

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

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

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));
Reply
#5

ownerid is an integer.
Reply
#6


It's still returned as string by mysql_fetch_field, hence strval.
Reply
#7

Ill try.
Reply
#8

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


Forum Jump:


Users browsing this thread: 1 Guest(s)