I am trying to access data on a mySQL server, but due to my age and alzheimer's I seem to be overlooking the obvious mistake here. Anyone care to spare a couple of minutes to help.
The resulting page if I bring it up in a browser has this on it
It suggests to me that the $query is at fault, but the sql query is correct I think ... duh isn't it ...??
Many thanks
Code:
<?
$host = "localhost";
$user = "root";
$pass = "";
$dbname = "wxoww";
$datatbl= "tbl_owwdata";
$connection = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error());
mysql_select_db ($dbname);
$sql = ("SELECT * FROM $datatbl ORDER BY qtm LIMIT 1") ;
$query = mysql_query($sql);
echo'<table border="0" width="100%">';
while ($row = mysql_fetch_array($query)) {
echo'<tr>
<td width="8%">'.$row["qtm"].'</td>
<td width="8%">'.$row["t1"].'</td>
<td width="8%">'.$row["t2"].'</td>
<td width="8%">'.$row["dp"].'</td>
<td width="8%">'.$row["rh"].'</td>
<td width="8%">'.$row["bp"].'</td>
<td width="8%">'.$row["wdspd"].'</td>
<td width="8%">'.$row["wdgst"].'</td>
<td width="8%">'.$row["wddir"].'</td>
<td width="8%">'.$row["rn"].'</td>
<td width="8%">'.$row["rnd"].'</td>
<td width="8%">'.$row["rnrt"].'</td>
</tr>'
}
echo'</table>';
?>
Code:
'; while ($row = mysql_fetch_array($query)) { echo' '.$row["qtm"].' '.$row["t1"].' '.$row["t2"].' '.$row["dp"].' '.$row["rh"].' '.$row["bp"].' '.$row["wdspd"].' '.$row["wdgst"].' '.$row["wddir"].' '.$row["rn"].' '.$row["rnd"].' '.$row["rnrt"].' ' } echo''; ?>
Many thanks
Comment