0

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>

Edited by Tackey

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by Nimrod7676
1

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']."'");
0

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)

Edited by Nimrod7676: extra post :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.