Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

Why does this produce an error?

I defused forums on my main site. Why does this still produce an error in PDO-MySQL?

CodeDownload  
$result = dbquery("SELECT * FROM ".DB_FORUM_POSTS."");
if (dbrows($result)) {
$num_rows = dbrows($result);
   if ($num_rows) {
   $posts = $num_rows;
   }
} else { $posts = 0; }



Since there is no table I assumed that this should work w/o error.
This? Notice: Use of undefined constant DB_FORUM_POSTS

Simple fix

CodeDownload  

if (defined('DB_FORUM_POSTS') && db_exists(DB_FORUM_POSTS)) {
$result = dbquery("SELECT * FROM ".DB_FORUM_POSTS."");
if (dbrows($result) > 0) {
$num_rows = dbrows($result);
 if ($num_rows) {
 $posts = $num_rows;
 }
} else { $posts = 0; }
}

That still didn't work but I modified it OK. Thanks !!
CodeDownload  
if (defined('DB_FORUM_POSTS') && db_exists(DB_FORUM_POSTS)) {
$result = dbquery("SELECT * FROM ".DB_FORUM_POSTS."");
if (dbrows($result) > 0) {
$num_rows = dbrows($result);
 if ($num_rows) {
 $posts = $num_rows;
 }
}
} else { $posts = 0; }

Thread Information
Author
Replies
3 posts
Views
41 times
Last Post
Last updated on 7 days ago
You can view all discussion threads in this forum.
You cannot set up a bounty in this discussion thread.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
Users who participated in discussion: Grimloch, RobiNN