Rodger123
Rodger123

Reputation: 33

Database returning zero rows

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';

Upvotes: 0

Views: 28

Answers (1)

baao
baao

Reputation: 73231

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'; 

Upvotes: 1

Related Questions