We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,870 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
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>
3
Contributors
2
Replies
31 Minutes
Discussion Span
1 Year Ago
Last Updated
3
Views
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

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0624 seconds using 2.65MB