SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    ********* Addict WP1's Avatar
    Join Date
    Aug 2000
    Location
    New York , USA
    Posts
    407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PROBLEM / with code and SQL

    Hello,

    I am running phpNuke v6.0

    I installed the "block-phpBB_Forums.php" which can be downloaded from,
    http://nuke4newbie.org/modules.php?name=Downloads&d_op=viewdownloaddetails&lid=5&ttitle=PHPBB2_center_block_1.0

    The script is by: Mat Verdonschot. The web site no longer exists at,
    http://members.lycos.nl/mverdonschot

    I keep getting the following SQL error codes,

    ------------------------------------------------------------
    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/WebSiteCodeFromHost/public_html/html/includes/sql_layer.php on line 253

    Warning: mysql_fetch_row(): supplied argument is not a validMySQL result resource in /home/WebSiteCodeFromHost/public_html/html/includes/sql_layer.php on line 301

    Warning: mysql_fetch_row(): supplied argument is not a validMySQL result resource in /home/WebSiteCodeFromHost/public_html/html/includes/sql_layer.php on line 301

    Warning: mysql_fetch_row(): supplied argument is not a validMySQL result resource in /home/WebSiteCodeFromHost/public_html/html/includes/sql_layer.php on line 301
    ------------------------------------------------------------

    This is the block code,
    Code:
    <?php
    if( eregi( "block-phpBB_Forums.php",$PHP_SELF ) )
    {
       Header("Location: index.php");
       die();
    }
    
    global $prefix, $dbi, $sitename;
    
    $Last_5_New_Topics = 7; // Show only 5 last new topics
    $border = 1;
    $bordercolor = "#E6E6FA"; //#cacaca
    $cellspacing = 5;
    $bgcolor = "#D6DFF7"; // #F0F8FF #B0C4DE
    $bgcolor2 = "#FFFFFF";  //#D6DFF7 #B0C4DE #6495ED 
    
    // Languages
    
    define("_BBFORUM_NEWTOPICS","New topics");
    define("_BBFORUM_POSTER", "Poster");
    define("_BBFORUM_VIEWS", "Views");
    define("_BBFORUM_REPLIES", "Replies");
    define("_BBFORUM_LASTPOSTER", "Last Poster");
    define("_BBFORUM_TOTTOPICS", "Topics ");
    define("_BBFORUM_TOTPOSTS", "Posts ");
    define("_BBFORUM_TOTVIEWS", "Views ");
    define("_BBFORUM_TOTREPLIES", "Replies ");
    define("_BBFORUM_TOTMEMBERS", "Members ");
    define("_BBFORUM_FORUM", "Forums");
    define("_BBFORUM_SEARCH", "Search");
    
    /* Total Amount of Topics */
    $result = sql_query( "SELECT * FROM ".$prefix."_topicsbb", $dbi );
    $Amount_Of_Topics = sql_num_rows( $result, $dbi );
    
    /* Total Amount of Posts */
    $result = sql_query( "SELECT * FROM ".$prefix."_posts", $dbi );
    $Amount_Of_Posts = sql_num_rows( $result, $dbi );
    
    /* Total Amount of Topic Views */
    $Amount_Of_Topic_Views = 0;
    $result = sql_query( "SELECT topic_views FROM ".$prefix."_topicsbb", $dbi );
    while( list( $topic_views ) = sql_fetch_row( $result, $dbi ) )
    {
       $Amount_Of_Topic_Views = $Amount_Of_Topic_Views + $topic_views;
    }
    
    /* Total Amount of Topic Replies */
    $Amount_Of_Topic_Replies = 0;
    $result = sql_query( "SELECT topic_replies FROM ".$prefix."_topicsbb", $dbi );
    while( list( $topic_replies ) = sql_fetch_row( $result, $dbi ) )
    {
       $Amount_Of_Topic_Replies = $Amount_Of_Topic_Replies + $topic_replies;
    }
    
    /* Total Amount of Members */
    $result = sql_query( "SELECT * FROM ".$prefix."_users", $dbi );
    $Amount_Of_Members = sql_num_rows( $result, $dbi );
    
    /* Last 5 New Topics */
    $Topic_Buffer = "";
    $result1 = sql_query( "SELECT topic_id, topic_last_post_id, topic_title, topic_poster, topic_views, topic_replies FROM ".$prefix."_topicsbb ORDER BY topic_last_post_id DESC LIMIT $Last_5_New_Topics", $dbi );
    while( list( $topic_id, $topic_last_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies ) = sql_fetch_row( $result1, $dbi ) )
    {
       $result2 = sql_query( "SELECT topic_id, poster_id, FROM_UNIXTIME( post_time,'%b %d, %Y at %T') as post_time FROM ".$prefix."_posts where post_id = '$topic_last_post_id'", $dbi );
       list( $topic_id, $poster_id, $post_time ) = sql_fetch_row( $result2, $dbi );
    
       $result3 = sql_query( "SELECT uname, uid FROM ".$prefix."_users where uid='$poster_id'", $dbi );
       list( $uname, $uid ) = sql_fetch_row( $result3, $dbi );
       $LastPoster = "<A HREF=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$uid\"STYLE=\"text-decoration: none\"> $uname </a>";
          
       $result4 = sql_query( "SELECT uname, uid FROM ".$prefix."_users where uid='$topic_poster'", $dbi );
       list( $uname, $uid ) = sql_fetch_row( $result4, $dbi );
       $OrigPoster = "<A HREF=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$uid\"STYLE=\"text-decoration: none\"> $uname </a>";
       
       $TopicImage = "<img src=\"modules/Forums/templates/subSilver/images/icon_mini_message.gif\" border=\"0\" alt=\"\">";
       $TopicTitleShow = "<a href=\"modules.php?name=Forums&amp;file=viewtopic&amp;p=$topic_last_post_id#$topic_last_post_id\"STYLE=\"text-decoration: none\"><b>$topic_title</b></a>";
       
       $Topic_Buffer .= "<tr><td>$TopicImage&nbsp;&nbsp;$TopicTitleShow</td><td><div align=\"center\">$OrigPoster</div></td><td><div align=\"center\"><b>$topic_views</b></div></td><td><div align=\"center\"><b>$topic_replies</b></div></td><td align=\"center\">$LastPoster<br><font size=\"-2\"><i>".substr($post_time,0,strpos($post_time,"at"))."</i></font></td></tr>";  
    }
    /*
    <table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#C0C0C0"><tr><td>
    <table width="100%" border="0" cellspacing="1" cellpadding="8" bgcolor="#E5E5E5"><tr><td>
    <center><font class="option"><b>phpBB Forums
    */
    
    
    
    /* Write Table to Screen  */
    
    $content  = "<table width=\"100%\" border=\"0\"  bordercolor=\"$bordercolor\" bgcolor=\"$bgcolor2\">"; //cellspacing=\"$cellspacing\"
    $content .= "<tr><td><img align=\"middle\" src=\"images/blocks/icon_community.gif\"></td><td width=\"100%\" height=\"21\" colspan=\"5\" align=\"center\"><b>&nbsp;<a href=\"modules.php?name=Forums\">$sitename Help Forums</a>&nbsp;</b></td><td><img align=\"middle\" src=\"images/blocks/icon_community.gif\"></td></tr>";
    $content .= "</table>";
    
    $content .= "<table bgcolor=\"$bgcolor\" width=\"100%\" border=\"$border\"  cellspacing=\"$cellspacing\" bordercolor=\"$bordercolor\" >"; // bgcolor=\"$bgcolor\"
    $content .= "<tr><td align=\"center\">"._BBFORUM_NEWTOPICS."</td><td align=\"center\">"._BBFORUM_POSTER."</td><td align=\"center\">"._BBFORUM_VIEWS."</td><td align=\"center\">"._BBFORUM_REPLIES."</td><td align=\"center\">"._BBFORUM_LASTPOSTER."</td></tr>";
    $content .= "$Topic_Buffer";
    $content .= "<tr><td align=\"center\" colspan=\"5\">"._BBFORUM_TOTTOPICS."<b>$Amount_Of_Topics</b>&nbsp;<b>|</b>&nbsp;"._BBFORUM_TOTPOSTS."<b>$Amount_Of_Posts</b>&nbsp;<b>|</b>&nbsp;"._BBFORUM_TOTVIEWS."<b>$Amount_Of_Topic_Views</b>&nbsp;<b>|</b>&nbsp;"._BBFORUM_TOTREPLIES."<b>$Amount_Of_Topic_Replies</b>&nbsp;<b>|</b>&nbsp;<a href=\"modules.php?name=Members_List\">"._BBFORUM_TOTMEMBERS."</a>&nbsp;<b>$Amount_Of_Members</b></center></td></tr>";
    $content .= "<tr><td align=\"center\" colspan=\"5\">[ <a href=\"modules.php?name=Forums\">"._BBFORUM_FORUM."</a> ]&nbsp;&nbsp;&nbsp;[ <a href=\"modules.php?op=modload&name=Forums&file=search\">"._BBFORUM_SEARCH."</a> ]</center></td></tr>";
    $content .= "</table>";
    ?>
    Any and all help with this would be appreciated.

    WP1
    Webbing Along!!!

  2. #2
    Sidewalking anode's Avatar
    Join Date
    Mar 2001
    Location
    Philadelphia, US
    Posts
    2,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My quick guess without seeing the underlying code behind the custom DB query function is that your database connection failed.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •