bigggnick Posted September 6, 2007 Share Posted September 6, 2007 Hello all, I'm writing an article system so people can write articles on my website. This is my first "big" project in PHP. In the section where an admin can either approve or deny the article, I keep getting this error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in articles/admin/show_article_admin.php on line 10 Here is the code for that file: <?php include "../config.php"; $article_name = mysql_real_escape_string(htmlentities($_REQUEST['article_name'])); $result = mysql_query("SELECT article_content, auth_name FROM articles WHERE article_name='$article_name' "); while($row = mysql_fetch_array($result, MYSQL_BOTH)){ echo '<h1>' . $row[article_name] . '</h1>'; echo 'By:' . $row[auth_name]; echo $row[article_content]; echo 'Would you like to approve this article?'; echo '<a href="approve_deny.php?article_name=$article_name&approved=yes">YES</a><a href="approve_deny.php?article_name=$article_name&approved=no">NO</a>'; } ?> Link to comment https://forums.phpfreaks.com/topic/68148-mysql_fetch_array-problem/ Share on other sites More sharing options...
schme16 Posted September 6, 2007 Share Posted September 6, 2007 Perhaps its that you've set not order? mysql_query("SELECT article_content, auth_name FROM articles WHERE article_name='$article_name' order by id desc"); replace the 'id' with what ever your using to list their id's Hope this worked! Link to comment https://forums.phpfreaks.com/topic/68148-mysql_fetch_array-problem/#findComment-342588 Share on other sites More sharing options...
bigggnick Posted September 6, 2007 Author Share Posted September 6, 2007 I think that will work, I'll give it a try. Thanks! Link to comment https://forums.phpfreaks.com/topic/68148-mysql_fetch_array-problem/#findComment-342606 Share on other sites More sharing options...
schme16 Posted September 6, 2007 Share Posted September 6, 2007 Lemme know if it doesn't, kay? Link to comment https://forums.phpfreaks.com/topic/68148-mysql_fetch_array-problem/#findComment-342682 Share on other sites More sharing options...
fenway Posted September 7, 2007 Share Posted September 7, 2007 Yeah, that's not it.... post the SQL query after variable interpolation. Link to comment https://forums.phpfreaks.com/topic/68148-mysql_fetch_array-problem/#findComment-343934 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.