xyn Posted August 9, 2006 Share Posted August 9, 2006 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 96and 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] Quote Link to comment https://forums.phpfreaks.com/topic/17033-warning-mysql_fetch_row/ Share on other sites More sharing options...
Daniel0 Posted August 9, 2006 Share Posted August 9, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/17033-warning-mysql_fetch_row/#findComment-71887 Share on other sites More sharing options...
xyn Posted August 9, 2006 Author Share Posted August 9, 2006 Unknown column 'id' in 'order clause' Quote Link to comment https://forums.phpfreaks.com/topic/17033-warning-mysql_fetch_row/#findComment-71906 Share on other sites More sharing options...
xyn Posted August 9, 2006 Author Share Posted August 9, 2006 yes I should have done that before posting really :/ Lol. and i found out the id should be news_id :/ Quote Link to comment https://forums.phpfreaks.com/topic/17033-warning-mysql_fetch_row/#findComment-71908 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.