Hi i have 2 errors on some software i brought for inbox can anyone tell me whats wrong with the code below to cause the errors any help would be much appreicated ty jan

Warning: implode() [function.implode]: Invalid arguments passed in /home/letsswin/public_html/inbox.php on line 198

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/letsswin/public_html/inbox.php on line 200

// Fetch user random for display on bottom

<h1> line 198</h1> $idtopuid  = implode(',', $topuid);
      $userquery    = mysql_query("select * from user where user_id != '".$_SESSION['userid']."' and user_id NOT IN (".$idtopuid.") order by rand() limit 0,5");
<h1> line 200</h1> while($fet_query=mysql_fetch_array($userquery))
      {
          $show_gender  = $fet_query['user_gender'];
          $show_id      = $fet_query['user_id']; 
          $fetch_img2   = mysql_fetch_array(mysql_query("select user_image from user_images where user_id = '".$show_id."' and main_image = '1' "));
          $show_img     = $fetch_img2['user_image'];
          ?>
      <div class="box">
        <?php if($show_img != '') { ?>
        <a href="viewprofile.php?profid=<?php echo $show_id;?>&gen=<?php echo $show_gender;?>"><img src="images/user_images/smallthumb/<?php echo $show_img;?>" border="0" width="100" height="80"/></a>
        <?php }

Recommended Answers

All 5 Replies

Seems like $topuid is not an array.
var_dump($topuid);exit;
just before line 198 to see what is there.

i have put that bit of code above line 198 and i get
Your Inbox List is Empty.
NULL

So that is the reason of second worning.
Now you would like to check code before and realize how to populate that array.
Find the point where you are expecting array being filled with elements and see what is going wrong.

im lost now hun

The implode() is failing because of $topuid not being an array which causes the mysql_query to fail and thus resulting in a false being stored in $userquery. Then, when mysql_fetch_array($userquery) is run it will fail because $userquery is a boolean and not a resource.

Which is why Tpojka said that $topuid should have been filled with data somewhere before the part that you posted. You'll have to go back further in order to spot the problem.

The fact that it's printing a "Your Inbox List is Empty" instead of an array seems to suggest that at some point the array should have been filled with inbox items, or that the script should have stopped before it reached this point but didn't.

As an FYI, if you google parts of the code you end up on a site where you can buy the code, and the comments on there do not look promising. Some mention the exact issue as you do and claim support has been discontinued by the developers. Furthermore, the use of mysql_query (instead of mysqli_query or PDO) is strongly discouraged, which brings into question the quality of the code you bought.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.