PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
include ("db.inc.php");
$query = "SELECT * FROM fpannounce";
$query2 = "SELECT * FROM content WHERE pagetitle='index'";
$result = mysql_query($query) or die("Whoops! Something wrong happened to the my database!");
$result2 = mysql_query($query2) or die("Whoops! Something wrong happened to the my database!");
if ($result && $result2)
{
while ($r = mysql_fetch_array($result && $result2))
{
extract($r);
echo "<div id="sidebar">$announce</div>";
echo "$body";
}
mysql_free_result($result && $result2);
}
mysql_close();
?>
I get the following errors in my file.....
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/tstowell/public_html/dev/index.php on line 130
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/tstowell/public_html/dev/index.php on line 136
Ok.. so if I want to do a select from a table and print the HTML code that I have input in a field, what would be the best way to lay out the code. Obviously I am doing something wrong here to get those errors.
you'll probably need to go through each query individually, either storing the data into an array, so you can combine them later, or just writing them out as you read them...