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>

Recommended Answers

All 2 Replies

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

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)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.