Php While Loop Sql Query Compiler C