Jump to content

LEFT JOIN problems


azz0r

Recommended Posts

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]

Link to comment
Share on other sites

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\'))"));

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.