php & mysql

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

php & mysql

Post 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
User avatar
xisle
Forum Contributor
Posts: 249
Joined: Wed Jun 25, 2003 1:53 pm

Post by xisle »

looks like $forum id should equal two..
kgray
Forum Newbie
Posts: 4
Joined: Sat Nov 27, 2004 11:53 am

Post 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 );
Post Reply