问题描述:

I have been having some trouble running SQLi queries in PHP, so I went to the database directly through PHP Admin and even when I run the most basic of queries such as the example below I am getting an empty results set.

Is there any reason why this could happen?

SELECT 'fname' FROM 'participants' WHERE 'sname' = 'Jones';

网友答案:

If you had error reporting enabled, you'd see that your query throws an error because you are using ' instead of backticks ` for your table and column names.

Try it like this:

SELECT `fname` FROM `participants` WHERE `sname` = 'Jones'; 
相关阅读:
Top