Jump to content

Archived

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

bluntedbynature

2 WHERE statements

Recommended Posts

ok, i got a database that has a feild called catID and pageID what i want to do is make it so they go to the site and the address looks like this index.php?cat=3&page=1

 

This is the way i set up the SQL

SQL-recordset.jpg

this is what im getting

SQL-no-data.jpg

 

but there is data in the database.

Share this post


Link to post
Share on other sites

ok i changed it alittle bit, to

WHERE site.catID = catID AND site.pageID = pageID

 

and now i get an pop up message saying

1054 Unknown column 'site.1' in 'where clause'
what the hell does that mean?

Share this post


Link to post
Share on other sites

well, since you're trying to call the variables the exact same name as the columns in the recordset, you're going to run into issues like that... you've said that siteID = 1 in the assigning of the variable, and then you try to select site.siteID which interprets to site.1

 

try to name your variables to something completely different that you know what they refer to. also, in your initial values, your default is being set to 1 and 1... make sure that you actually have a recordset with the cat value of 1 AND site value of 1

Share this post


Link to post
Share on other sites
dude your the best. i would have never thought to look at that. thanks for the help.

240341[/snapback]

 

that's what we're here for! ;-)

Share this post


Link to post
Share on other sites

×

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.