MySQL - Fields/Rows are empty, but they aren't.
#1

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)