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
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]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.