SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 15/10/2011, 10:26 AM   #1
Jochemd
High-roller
 
Jochemd's Avatar
 
Join Date: Jul 2009
Location: The Netherlands
Posts: 2,220
Reputation: 844
Default MySQL - Fields/Rows are empty, but they aren't.

I queried "DESCRIBE GlobalInfo" in MySQL (GlobalInfo is also a table)
Code:
ConfigKey	varchar(20)	NO	PRI	0	
ConfigValue	int(11)	YES

This code is executed in OnGameModeInit. It seems to be fine?
Code:
mysql_query("SELECT * FROM `GlobalInfo` WHERE `ConfigKey` = 'GasStationFuel'");
mysql_store_result();
mysql_get_field("ConfigValue",Store);
GlobalInfo[GasStationFuel] = strval(Store);
Now the MySQL log returns this:

Code:
[10:24:43] CMySQLHandler::Query(SELECT * FROM `GlobalInfo` WHERE `ConfigKey` = 'GasStationFuel') - Successfully executed.
[10:24:43] >> mysql_store_result( Connection handle: 1 )
[10:24:43] CMySQLHandler::StoreResult() - Result was stored.
[10:24:43] >> mysql_fetch_field_row( Connection handle: 1 )
[10:24:43] CMySQLHandler::FetchField(ConfigValue) - You cannot call this function now. (Reason: Fields/Rows are empty.)
And this is the stuff put in the table:


I don't understand why it says the fields are empty? As you see, it's not!

Jochem
__________________
Jochemd is offline   Reply With Quote
Old 15/10/2011, 10:28 AM   #2
SloProKiller
Huge Clucker
 
Join Date: Aug 2009
Location: Slovenia
Posts: 259
Reputation: 3
Default Re: MySQL - Fields/Rows are empty, but they aren't.

pawn Code:
if(mysql_retrieve_row())
{
    mysql_query("SELECT * FROM `GlobalInfo` WHERE `ConfigKey` = 'GasStationFuel'");
    mysql_store_result();
    mysql_get_field("ConfigValue",Store);
    GlobalInfo[GasStationFuel] = strval(Store);
}
Should work.
__________________
SloProKiller is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Priting Fields From Mysql ihatetn931 Help Archive 5 20/04/2011 09:17 AM
Mysql Number of rows? DarrenReeder Help Archive 9 17/04/2010 05:25 PM
MySQL Storing fields Daren_Jacobson Help Archive 0 07/09/2009 08:36 PM


All times are GMT. The time now is 07:49 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.