Jump to content

Recommended Posts

Hey.
I have this error:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/eumod/public_html/en/index.php on line 96

and line 96:
while( $data = mysql_fetch_row($sql))
      {

code:
[code=php:0]<?PHP
include("db/db.php");
$sql = mysql_query("SELECT * FROM news WHERE news_old='n' ORDER BY id DESC");
              while( $data = mysql_fetch_row($sql))
              {
              $sql2 = mysql_query("SELECT * FROM comments WHERE news_id='".$data[0]."'");
              $num = mysql_num_rows($sql2);
             
              echo '<div align="left">
  <table border="0" cellpadding="2" style="border-collapse: collapse" bordercolor="#111111" width="90%">
    <tr>
      <td width="100%" colspan="2"><i><b>'.$data[1].'</b></i></td>
    </tr>
    <tr>
      <td width="100%" colspan="2">'.$data[2].'</td>
    </tr>
    <tr>
      <td width="100%" colspan="2">
      <hr color="#AAD2FF" width="95%" align="left" style="border: 1px dotted #AAD2FF" size="1">
      </td>
    </tr>
    <tr>
      <td width="50%">[ '.$data[6].' | '.$data[4].' : '.$data[5].' ]</td>
      <td width="50%">
      <p align="right"><b>'.$num.'</b> <a href="#top">Comments</a> | <a href="#top">
      Read more</a>...</td>
    </tr>
  </table>
</div>
<br>';
}
              ?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/17033-warning-mysql_fetch_row/
Share on other sites

Try change this line: [code]$sql = mysql_query("SELECT * FROM news WHERE news_old='n' ORDER BY id DESC");[/code] to [code]$sql = mysql_query("SELECT * FROM news WHERE news_old='n' ORDER BY id DESC") or die(mysql_error());[/code] and tell me if it returns an error.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.