Jump to content


Photo

LEFT JOIN problems


  • Please log in to reply
2 replies to this topic

#1 azz0r

azz0r
  • Members
  • Pip
  • Newbie
  • 3 posts

Posted 27 November 2003 - 04:50 PM

I want to select new posts posted after a cookie string, and where the forum type = anon or publ.

However my left join query seems to just close the page off from loading! Help please.

[php:1:d36cd25b7f]if($_COOKIE[\'last_visit\'])
{$count = mysql_num_rows(mysql_query(\"SELECT p.time, p.pid, f.type, f.fid FROM $forumzDB.forumz_posts p
LEFT JOIN $forumzDB.forumz_forums f
ON (p.fid = f.fid) WHERE ((p.time > \".$_COOKIE[\'last_visit\'].\") && (f.type = \'anon\' OR f.type = \'publ\'))\")) or die(mysql_error());

if($count < 1)
{echo \"No new posts\";}
else
{echo \'<a href=\"?section=new_posts&np=\'.$_COOKIE[\'last_visit\'].\'\">\'.$count.\' new posts</a>\';}}
else
{echo \'Cookie was just set\';} ?>[/php:1:d36cd25b7f]
My forums faster than yours, na na na :P

#2 azz0r

azz0r
  • Members
  • Pip
  • Newbie
  • 3 posts

Posted 27 November 2003 - 10:36 PM

bump :oops:
My forums faster than yours, na na na :P

#3 azz0r

azz0r
  • Members
  • Pip
  • Newbie
  • 3 posts

Posted 28 November 2003 - 06:25 PM

and the code to get it working was...

$count = mysql_num_rows(mysql_query("SELECT p.time, p.pid, f.type, f.fid FROM $forumzDB.forumz_posts p   	LEFT JOIN $forumzDB.forumz_forums f  	ON (p.fid = f.fid) WHERE ((p.time > ".$_COOKIE[\'last_visit\'].") && (f.type = \'anon\' OR f.type = \'publ\'))"));

My forums faster than yours, na na na :P




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users