Jump to content


Photo

join syntax


  • Please log in to reply
2 replies to this topic

#1 chico1st

chico1st
  • Members
  • PipPipPip
  • Advanced Member
  • 60 posts

Posted 18 August 2006 - 05:02 AM

Hey im having trouble with a join, as far as i can figure it should work but i get:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\Lib.php on line 206

this worked fine before i tried to join it so i think that must be the problem

$query = "SELECT news.newsID, news.pictureID, news.dateID, news.name, news.abstract, date.dateID, date.name " .
  "FROM news, date WHERE news.dateID = date.dateID ORDER date.name";


$result = mysql_query($query, $dbConn);

 
  //print 2 most recent news articles
  for( $i = 0; $i <2; $i++){
$output .= "\n<tr><td>";
$row = mysql_fetch_assoc($result);
        $news_id = $row['news.newsID'];
$name = $row['news.name'];
$abstract = $row['news.abstract'];
$image_id = $row['news.pictureID'];
      ....

any help you can offer would be GGGGGRRREEAT!

#2 manmadareddy

manmadareddy
  • Members
  • PipPipPip
  • Advanced Member
  • 50 posts

Posted 18 August 2006 - 05:07 AM

I think mysql is treating date as keyword or function. Please check

#3 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 18 August 2006 - 04:08 PM

Perhaps... also, you should write JOINs using the proper syntax, without using the comma operator.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users