PDA

View Full Version : MySQL - Fields/Rows are empty, but they aren't.


Jochemd
15/10/2011, 10:26 AM
I queried "DESCRIBE GlobalInfo" in MySQL (GlobalInfo is also a table)

ConfigKey varchar(20) NO PRI 0
ConfigValue int(11) YES


This code is executed in OnGameModeInit. It seems to be fine?

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:


[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:
http://i.imgur.com/SEcNX.png

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

Jochem

SloProKiller
15/10/2011, 10:28 AM
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.