Jump to content

unknown column $name in 'where clause'


turpentyne

Recommended Posts

I'm trying to pull data to display on a page and I seem to be missing something in the where clause. I've verified I've named the right table, column and that a record exists. The caps are the same. The spelling is the same.

 

I get this error: Unknown column '$id' in 'where clause'

 


$id = $_GET['id'];
    require ('databaseconnect.php');


   $result = mysql_query('SELECT * FROM descriptors WHERE $id = plant_id');
if (!$result) {
    die(mysql_error());
}


        while ($row = mysql_fetch_array($result)) { 
//etc. etc.

Link to comment
https://forums.phpfreaks.com/topic/215016-unknown-column-name-in-where-clause/
Share on other sites

  • 2 weeks later...

hello

 

i've got the same problem...

 

MySQL client version: 5.1.41

here's my code:

$q="SELECT * FROM gallery_album WHERE name = BMWcars";
$result = mysql_query($q)or die("Query failed with error: ".mysql_error());

:confused:

 

where gallery_album is my table

name is a column

BMWcars is the name of an album that i get before in the page

 

[attachment deleted by admin]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.