Start New Discussion Reply to this Discussion Mysql_fetch_array()
I keep on getting this warning message Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\test\checkPosts.php on line 12
<html>
<p><a href = "postArt.php"> Post Article </a></p>
<p><a href = "editArticle.php"> Edit Article </a></p>
<p><a href = "viewAllPosts.php"> View All Article </a></p>
<p><a href = "Logout.php"> Logout </a></p>
<p>Search <input type "text" name = "search"> </p>
<table>
<?php
include 'connect.php';
session_start();
$result2 = MYSQL_QUERY("select title, content, tag, date from article where author == ." .$_SESSION['id']. ".");
if(!$row = mysql_fetch_row($result2)or die($result2."<br/><br/>".mysql_error()));
echo "<tr><td>$row[column1]</td><td>$row[column12]</td></tr>";
?>
</table>
</html>
31 Minutes
Discussion Span
Related Article: error in mysql_fetch_array();
is a solved PHP discussion thread by Awah Mohamed that has 2 replies, was last updated 1 year ago and has been tagged with the keywords: mysql, mysql_fetch_array, php.
Tackey
Newbie Poster
4 posts since Dec 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Hi,
Try removing the extra equal operator in your query..
$result2 = MYSQL_QUERY("select title, content, tag, date from article where author == ." .$_SESSION['id']. ".");
like this
$result2 = MYSQL_QUERY("select title, content, tag, date from article where author = '" .$_SESSION['id']."'");
veedeoo
Master Poster
735 posts since Oct 2011
Reputation Points: 298
Solved Threads: 129
Skill Endorsements: 13
your query ruturns false. mysql_fetch_row requires an resource parameter.
try to replace youre currect qurey with the above post query. replace == with =. It should be work.
Good luck! P.S I reccomnd you call all the function written in lower case.
if(!$row = mysql_fetch_row($result2)) or die($result2."<br/><br/>".mysql_error()));
add extra close-bracket. (I did it for you)
Nimrod7676
Newbie Poster
13 posts since Jan 2012
Reputation Points: 10
Solved Threads: 2
Skill Endorsements: 2
© 2013 DaniWeb® LLC
Page rendered in 0.0624 seconds
using 2.65MB