The variable WILL be parsed as a PHP varialbe.. are there any errors at all? forinstans remove error_suppression infornt of the mysql_query and put a die(mysql_error()) after the select query.. check if the $num really is going to be more then 0