mysql_fetch_array() expects parameter 1 to be resource
<pre><code>&lt;?php
//connect to MYSQL
$con=mysql_connect("localhost","root","");
if (!$con)
{
          die ('cannot connect:'.mysql_error());
}

//to show the original message
mysql_select_db("tracking", $con);

$result = "SELECT lat, lng, DATE_FORMAT(datetime,'%W %M %D, %Y %T') AS datetime FROM markers1 WHERE 1";
if (!$result) { // add this check.
    die('Invalid query: ' . mysql_error());
}


echo "&lt;table border='1'&gt;
&lt;tr&gt;

&lt;th&gt;id No&lt;/th&gt;
&lt;th&gt;lat Time&lt;/th&gt;
&lt;th&gt;lng&lt;/th&gt;
&lt;th&gt;datetime&lt;/th&gt;
&lt;/tr&gt;";

while($row = mysql_fetch_array($result))
  {
  echo "&lt;tr&gt;";
  echo "&lt;td&gt;" . $row['id'] . "&lt;/td&gt;";
  echo "&lt;td&gt;" . $row['lat'] . "&lt;/td&gt;";
  echo "&lt;td&gt;" . $row['lng'] . "&lt;/td&gt;";
  echo "&lt;td&gt;" . $row['datetime'] . "&lt;/td&gt;";

  echo "&lt;/tr&gt;";
  }
echo "&lt;/table&gt;";

mysql_close($con);
</code></pre>

<p>It show me  mysql_fetch_array() expects parameter 1 to be resource.</p>

<p>Can anyone help me .thx.</p>
