Hi All,
I am trying to display the content of a single row from MySql with the following code but the echo is displaying nothing at all. Please can you advise as to where i can find the error?
I have a feeling its something to do with the loop, as in effect there is no loop required, but on removing it i get an error.
Any help you can give is greatly appreciated.
Here is the code:
<?
// Select all data records in table "name_list" and put them into $result.
$result=mysql_query("SELECT * from `indexinfo` WHERE id = '1'");
//store the queried cell in the variable
//named $result
$result = mysql_query($sql_query);
//display the queried cell
$row = mysql_fetch_array($result);
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="update.php">
<table border="1" cellpadding="3" cellspacing="0">
<tr>
<td align="center" bgcolor="#FFCC00"><strong>id</strong></td>
<td align="center" bgcolor="#FFCC00"><strong>Title</strong></td>
<td align="center" bgcolor="#FFCC00"><strong>Subtitle</strong></td>
<td align="center" bgcolor="#FFCC00"><strong>Content</strong></td>
<td align="center" bgcolor="#FFCC00"><strong>Author</strong></td>
<td align="center" bgcolor="#FFCC00"><strong>Date</strong></td>
</tr>
<? echo $row['id']; ?>
<? echo $row['Title']; ?>
<? echo $row['Subtitle']; ?>
<? echo $row['Content']; ?>
<? echo $row['Author']; ?>
<? echo $row['Date']; ?>
</table>
<input type="submit" name="Submit" value="Update" />
</form>
</body>
</html>