[RESOLVED] Select * works but not individual columns
Hello,
could you please help me figure out why selecting all works but not individual columns? When selecting individual columns I get an empty result set.
Code is below.
I greatly appreciate the help, i have been looking at this for hours.
PHP Code:
function getBookReviews($connection)
{
//works
$sql="SELECT * FROM theDatabase Where isbn = " . $_POST['isbn'];
//returns empty set
//$sql="SELECT index, parent, user, primary, review, spoilers FROM theDatabase Where isbn = " . $_POST['isbn'];
Try quoting the column names -- in MySQL typically done with the `back-tick` character -- as some of them may be reserved words.
PS: You can help the debugging by checking to see if the result of your mysql_query() is false, and if so log or output an error with info from mysql_error().
PPS: The PHP MySQL extension is now deprecated, and you should really be using either the MySQLi extension or even the PDO extension.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks