[Solved] unknown column in where clause

$result = mysql_query("SELECT * FROM Volunteers WHERE Volunteers.eventID = " . $var);

$sql = mysql_query("SELECT * FROM Members WHERE = " . $temp);

I am also doing or die(mysql_error()) at the end of both statements if that matter. My problem is that the first statement executes perfectly but in that table I store an attribute called pid. So the second statement is supposed to take that and return the row where it equals that pid so I can get the name. I get an error that says unknown column in ‘a2’ in ‘where clause’ where a2 the pid attribute returned from the first statement.

Thanks for any help!

EDIT: Figured out what was wrong.
Had to write the code like this:

$sql = mysql_query("SELECT * FROM Members WHERE = '$temp'") or   die(mysql_error());
Enquirer: ranzy

Solution #1:

I think I see what you are trying to do, you can do this in one query, by JOIN-ing the tables together. the SQL query should be something like

SELECT Members.* FROM Members INNER JOIN Volunteers ON WHERE Volunteers.eventID=" . $var

Check out This for a basic introduction to SQL joins.

Respondent: ranzy
The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy