Can anyone help me out Im having trouble getting this script to work. Its suposed to display all the results if a county is matched in the SQL table. My Original problem was that the script never showed the first row in the database, so I changed the 'while loop' to a 'do while'. Now Im getting all sorts of syntax errors and I dont know what to do to correct it.
if (isset($search))
{
$result = mysql_query("SELECT * FROM stockist WHERE county like '%$search%'",$db) or die(mysql_error());
echo "<table border='0' cellpadding='3' width='500'>";
if ($myrow = mysql_fetch_array($result)) {
do {
printf("<tr>
<td><b>%s</b><br>%s<br>%s, %s<br>%s<p> </p></td>
<td valign='top' align='right'><b>Telephone:<br>
Email:<br>
Website:</td>
<td valign='top'>
<font color='#00009'> %s</font><br>
<font color='#000099'><a href='mailto:%s'>%s</a></font><br>
<font color='#000099'><a href='%s'>%s</a></font></td>
</tr>",
$myrow[1],
$myrow[2],
$myrow[3],
$myrow[4],
$myrow[5],
$myrow[6],
$myrow[7],
$myrow[7],
$myrow[8],
$myrow[8])
} while ($myrow = mysql_fetch_array($result));
echo "</table>";
} else {
echo $error;
}
?>