Mysql - read value from Table WHERE id=x
#1

I have table name "factions" and i want to extract the value of a row "groupSlots" WHERE id=1 (for faction id=1)

i've tried this
Код:
stock GetFactionSlots( FactionID )
{
	new szString[ 128 ], Cache: Result, Get[ 2 ], szFacSlots[ MAX_PLAYER_NAME ];
	format( szString, sizeof( szString ), "SELECT `groupSlots` FROM `factions` WHERE `ID` = %d ;", FactionID );
    Result = mysql_query( SQL, szString );
    cache_get_data( Get[ 0 ], Get[ 1 ], SQL );
    if( !Get[ 0 ] ) szFacSlots = "No-One";
   	 else cache_get_field_content( 0, "groupSlots", szFacSlots, SQL, sizeof( szFacSlots ) );
    cache_delete( Result );
	return ( szFacSlots );
}
and in cmd:factions
Код:
new szString[ 1200 ];			
	format( szString, sizeof( szString ), "{0059FF}Police Departament 		{ffffff}-	Lider: %s (%s) - Membri: %d/%d\n", GetFactionLeader( 1 ), IsOnline( GetFactionLeader( 1 ) ), GetFactionMembers( 1 ) , GetFactionSlots( 1 ) );
groupSlots for faction id 1 value is 6
but on server when running "/factions" returns me something else...
Reply


Messages In This Thread
Mysql - read value from Table WHERE id=x - by CaTaLinU - 31.05.2015, 09:10
Re: Mysql - read value from Table WHERE id=x - by Konstantinos - 31.05.2015, 10:58
Re: Mysql - read value from Table WHERE id=x - by CaTaLinU - 01.06.2015, 09:19

Forum Jump:


Users browsing this thread: 2 Guest(s)