Jump to content

Archived

This topic is now archived and is closed to further replies.

xyn

Warning: mysql_fetch_row():

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]

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
Unknown column 'id' in 'order clause'

Share this post


Link to post
Share on other sites
yes I should have done that before posting really :/ Lol. and i found out the id should be news_id :/

Share this post


Link to post
Share on other sites

×

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.