+ 3

PHP and SQL

Good evening, readers. Faced with such a problem that the code with SQL data validation in the PHP programming language simply does not work, no error - nothing. I need to take the columns where the rating of the game is more than 7 races and display it on the screen, and it does not display. The code will be checked below. $sql = "SELECT * FROM 'horrors' WHERE 'Rate Game' < 6"; echo $sql;

26th Sep 2021, 6:19 PM
Ivan Zaycev
Ivan Zaycev - avatar
3 ответов
+ 2
Maybe try to change the condition to > 7 (not < 6) And use back ticks e.g. `quoted` rather than single quote e.g. 'quoted' for enclosing table and field name.
26th Sep 2021, 8:39 PM
Ipang
+ 2
No, it doesn't. I suspect that echo($sql); is used incorrectly. Can mysql_result do it?
27th Sep 2021, 12:28 PM
Ivan Zaycev
Ivan Zaycev - avatar
+ 1
Basically the column name should not contains space, it is not a best practice. Anyhow check this query “SELECT * FROM ‘horrors’ WHERE `Race Game` > 7
27th Sep 2021, 1:42 PM
Mohamed Shafnas