printf( "Name: %s", GetGangName( 1 ) ); // Result: "Name: "
stock GetGangName( gaujosID )
{
new
gPavadinimas[ 22 ]
;
format( query, sizeof( query ), "SELECT `gPavadinimas` FROM `gaujos` WHERE `gID` = %d", gaujosID );
mysql_query( query );
mysql_store_result( );
mysql_get_field( "gPavadinimas", gPavadinimas );
mysql_free_result( );
return gPavadinimas;
}
8:39:37] CMySQLHandler::Query(SELECT gPavadinimas FROM gaujos WHERE gID = 1) - Successfully executed. [18:39:37] >> mysql_store_result( Connection handle: 1 ) [18:39:37] CMySQLHandler::StoreResult() - Result was stored. [18:39:37] >> mysql_fetch_field_row( Connection handle: 1 ) [18:39:37] CMySQLHandler::FetchField(gPavadinimas) - You cannot call this function now. (Reason: Fields/Rows are empty.) [18:39:37] >> mysql_free_result( Connection handle: 1 ) [18:39:37] CMySQLHandler::FreeResult() - Result was successfully free'd.
WHERE `gID` = %d
WHERE `gID` = '%d'
mysql_get_field( "gPavadinimas", gPavadinimas );
mysql_fetch_row_format( query, "|" );
format( gPavadinimas, sizeof( gPavadinimas ), "%s", query );
Integers do not need to be enclosed in quotes. In fact, a query
SELECT gPavadinimas FROM gaujos WHERE gID = %d is perfectly valid as well. You don't need to use single quotes unless you have a string or a word that will be handled specially (as a keyword) by MySQL. zgintasz, run the same query in phpMyAdmin and see if it gives a valid result. Assuming it does, try using a different function for handling the loading of this string. As far as I know, you're selecting only one field, but then using a very comprehensive function to access it! There must be something simpler like mysql_fetch_row. |
mysql_fetch_row_format(gPavadinimas, "|");
Thanks for reply. Query in phpMyAdmin returns a correct value. I changed
pawn Код:
pawn Код:
|