I have the following layout which works fine, but I would like to know if its the best structure and is there a easier more structured way to achieve the same thing.
<?php
include("includes/db.config.php");
?>
<?php
$sql = "SELECT *
FROM log
WHERE PLC LIKE '%" . mysql_escape_string($_GET['PLC']) . "%'
ORDER BY DateOpened DESC ";
if (empty($_GET['PLC']))
$sql = "SELECT * FROM PLC WHERE 1 = 2 ";
$res = mysql_query($sql);
?>
<form>
<span class="ContentStyle">Please enter PLC name </span><span class="style4"> </span>
<input type="text" name="PLC" size="20" maxlength="20" value="<?=$_GET['PLC']?>" >
<input name="submit" type="submit" value="Search">
<span></span>
</form>
<table width="692">
<tr>
<?php
while ($r = mysql_fetch_assoc($res)) {
?>
<td width="133"><a href="ocado_edit_my_log.php?id=<?=$r['id']?>">Edit</a></td>
<td width="543"><a href="singlelog.php?id=<?=$r['id']?>"><?=$r['PLC']?></a></td>
</tr>
<tr>
<td>Date raised</td>
<td><?=$r['DateOpened']?></td>
</tr>
<tr>
<td>raised by</td>
<td><?=$r['Raised_by']?></td>
</tr>
<tr>
<td>Block</td>
<td><?=$r['Block']?></td>
</tr>
<tr>
<td>Description</td>
<td><?=$r['Description']?></td>
</tr>
<?php
}
?>
</table>
Edited by fenway, 24 February 2013 - 03:45 PM.
added code tags












