PDA

View Full Version : Mysql Bool


ancezas
20/03/2013, 03:39 PM
Hello, sorry for bad english but i whant some help, how to load bool veriables?

hear is mine script, its allways set it in true :(

if( mysql_fetch_field_row( fetch, "Telas" ) ) playerDB[ playerid ][ turitel ] = true;

Misiur
20/03/2013, 03:42 PM
Bool is stored as tinyint in database (0/1, not false/true)

mysql_fetch_field_row( fetch, "Telas");
playerDB[ playerid ][ turitel ] = !!strval(fetch);

!! is neat trick to change any variable into boolean

#e: pardon

ancezas
20/03/2013, 04:13 PM
Thx, it's working