| | i would like to suggest that you make sure that your sql queries are correct. that error usually shows up when the function mysql_query() return a value of false which is not a valid resource. this happens because of errors in sql queries. |
|
|
Ive checked all the queries numberous times but I can't find the error, also, i have a file (news.php) wich has the EXACT same code of displayNews and that one is NOT showing errors....please, could it be anything else?
CODE function displayNews($all = 0) { global $db, $max_items; if ($all == 0) { $query = "SELECT id, title, newstext, date_format(postdate, \'%Y-%m-%d\') as date FROM news ORDER BY postdate DESC LIMIT $max_items"; } else { $query = "SELECT id, title, newstext, date_format(postdate, \'%Y-%m-%d\') as date FROM news ORDER BY postdate DESC"; } if (!($result = mysql_query($query, $db))) { exit('MySQL Query Error: ' . mysql_error() . ' | SQL Query: ' . $query . ' | Line: ' . __LINE__); } while ($row = mysql_fetch_assoc($result)) { $date = $row['date']; $title = htmlentities($row['title']); $news = nl2br(strip_tags($row['newstext'], '<a><b><i><u>')); echo "<table border=\"1\" width=\"300\" align=\"center\">\n"; echo "<TR><TD><b>$title</b> posted on $date</td></tr>\n"; echo "<TR><TD>$news</td></tr>\n"; $comment_query = "SELECT count(*) FROM news_comments WHERE news_id={$row['id']}"; if (!($comment_result = mysql_query($query, $db))) { exit('MySQL Query Error: ' . mysql_error() . ' | SQL Query: ' . $comment_query . ' | Line: ' . __LINE__); } $comment_row = mysql_fetch_row($comment_result); echo "<TR><TD><a href=\"{$_server['php_self']}"."?action=show&id={$row['id']}\">Comments</a>"."($comment_row[0]}</td></tr>\n"; echo "</table>\n"; echo "<br>\n"; } if ($all == 0 ) { echo "<a href=\"{$_server['php_self']}?action=all\">View all news</a>\n"; } }
Similar Topics
Keywords : yep news
I want to know how the websites like www.myway.com publish news? They do not have their own news .. Im looking for some script which can fetch news from Reuters or any other news website and publish Hey everyone. It appears to me that everyone really know what they are doing in this forum and im a Looking for yep, time, news
|
|
![]() Yep It's Me Again >.> - This time with news! |
| ADD REPLY / Got an Opinion! | a humble request :-) | RAPID SEARCH! | Free Hosting | [X] |
|
Express your Opinions, Thoughts or Contribute your information that might help someone here. Ask your Doubts & Queries to get answers.. "Together, We enlight each other!" |
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP. | 500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE |
|