Webmaster Forums Biz

Full Version: Help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I keep getting this error:

Warning: mysqli_error() expects parameter 1 to be mysqli, null given in /homepages/17/d214435355/htdocs/wsb4613182101/testforum/viewTopic.inc on line 26

Here is the source code:

PHP Code:
<?php
/* Program: viewTopic.inc
 * Desc:    Program that displays the discussion threads
 *          within a selected topic. Each thread displays
 *          a link to the posts within that thread.
 */


  
include("functions_viewtopics.inc");
  echo 
'<html>';
  echo 
'<head>';
  echo 
'<title>Topic ' $_GET['topicID'] .'</title>';   #12
  
echo '<link rel="stylesheet" href="Forums.css" type="text/css"></head>';
  echo 
'<body>';
  
$connect Connect_to_db("forumVars.inc");             #15
  
$query "SELECT Thread.*, date, author
            FROM Thread, Post
            WHERE
              parent_topic   =" 
$_GET['topicID'] . " AND
              parent_thread  = Thread.id AND
              in_reply_to    IS NULL"
;
  
$result mysqli_query$connect$query );            #22
  
if ($result == 0)
  {
    echo 
"<b>Error: ";
    echo 
mysqli_error($cxn)."</b>";
  }
  else                                                   
#28
  
{
    echo 
"<table width=\"100%\" 
                 class=\"forumline \"cellpadding=\"4\""
;
    echo 
" cellspacing=\"2\" border=\"0\" align=\"center\">";
    echo 
"<tbody>";
    
DisplayThreadsHeader();
    for( 
$i 0$i mysqli_num_rows$result ); $i++ ) #35
    
{
      
$thread mysqli_fetch_assoc$result );
      echo 
"<tr>\n";
      echo 
'<td class="threadSubject">';                 #39
      
echo '<a href="viewThread-OO.php?threadID='.
                     
$thread['id'] . '">';
      echo   
$thread['subject'];
      echo   
'</a>';
      echo 
"  </td>\n";
      
AddField$thread"replies",   "threadFiller" );  #45
      
AddField$thread"author",    "threadFiller" );
      
AddField$thread"last_post""threadFiller" );
      echo 
"</tr>\n";
    }
    echo 
"</tbody></table>";
    echo 
'<b><a href="postMessage-OO.php?topicID='.
                               
$_GET['topicID']. '">';
    echo 
"Start a new thread</a></b>";
  }
?>


Please help

Ugh...

Code:
echo mysqli_error($cxn)."</b>";


Try making that an if statement

Code:
if (mysqli_error($cxn)){ echo mysqli_error($cxn)."</b>";


Or something like that.

Never mind i fixed it.
Reference URL's