i use the following code in serveral documents, why doesn't it work in some documents?
Error-Message:
Warning: Supplied argument is not a valid MySQL result resource in Welcome.php3 on line 42
Code:
<?php
$db = mysql_connect("localhost", "root", "password");
mysql_select_db("news",$db);
$result = mysql_query("SELECT * FROM news",$db);
if ($myrow = mysql_fetch_array($result))
{
echo "<br>";
do
{
---commands---
}
while ($myrow = mysql_fetch_array($result));
}
else
{
echo "ERROR: no news were found!";
}
?>