Page 1 of 1

[Solved]mysql_fetch_array() problem

Posted: Sat Sep 05, 2009 11:20 pm
by techkid
I'm having a problem with blog.php file.

Blog.php?act=view&id=6 <-- this one shows individual post
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\supp\b-class.php on line 17

Here is the code for that part

Code: Select all

//view the news article!
if(isset($_GET['act']) && $_GET['act'] == "view")
{
$id = $_GET['id'];
$sql = mysql_query("SELECT * FROM content WHERE index = '$id'");
while($row = mysql_fetch_array($sql))
{
echo "<div id='post'>";
echo "<h3>" . $row['title'] . "</h3>";
echo '<a href="blog.php?act=view&id='.$row['index'].'">'.$row['title'].'</a>';
echo $row['news'];
echo '<p class="postend">Posted by: '.$row['author'].' | Date:'.$row['date'].'</p></div>';
}
Here is the database scheme:
Image

Re: mysql_fetch_array() problem

Posted: Sun Sep 06, 2009 12:19 am
by requinix
Use mysql_error to get an error message.

Oh, and
techkid wrote:Here is the database scheme:
Yeah... The picture isn't all that useful.