Jump to content


Photo

2 WHERE statements


  • Please log in to reply
4 replies to this topic

#1 bluntedbynature

bluntedbynature
  • Members
  • Pip
  • Newbie
  • 5 posts

Posted 07 June 2005 - 01:26 PM

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
Posted Image
this is what im getting
Posted Image

but there is data in the database.

#2 bluntedbynature

bluntedbynature
  • Members
  • Pip
  • Newbie
  • 5 posts

Posted 07 June 2005 - 01:31 PM

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?

#3 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 07 June 2005 - 01:40 PM

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
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#4 bluntedbynature

bluntedbynature
  • Members
  • Pip
  • Newbie
  • 5 posts

Posted 07 June 2005 - 02:05 PM

dude your the best. i would have never thought to look at that. thanks for the help.

#5 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 07 June 2005 - 02:08 PM

dude your the best. i would have never thought to look at that. thanks for the help.

View Post


that's what we're here for! ;-)
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users