Page 1 of 1

php & mysql

Posted: Tue Nov 30, 2004 3:13 pm
by SidewinderX
hello i have a code that shows recent posts in forums..the piece of code im working with is

Code: Select all

$result1 = sql_query( "SELECT auth_view, auth_read FROM ".$prefix."_bbforums where forum_id = '$forum_id'", $dbi );
i only want it to display the topics in a certain forum...so my question is how can i make the code only pull out the posts from ".$prefix."_bbforums when the forum_id is 2

Posted: Tue Nov 30, 2004 3:35 pm
by xisle
looks like $forum id should equal two..

Posted: Tue Nov 30, 2004 5:42 pm
by kgray
Newbie so I may be wrong, but shouldn't $forum_id not be enclosed in singe quote?

Code: Select all

#like this
$result1 = sql_query( "SELECT auth_view, auth_read FROM ".$prefix."_bbforums WHERE forum_id = $forum_id", $dbi );
   #or this
$result1 = sql_query( "SELECT auth_view, auth_read FROM ".$prefix."_bbforums WHERE forum_id = ".$forum_id, $dbi );