Can anyone help me out here !!
The following source code displays a list of stockists one after the other if a match on the county is made. The problem Im having is
The results never display the first row in the database.
The page can be seen at
www.rpa-solutions.com/stockist/
and full source at
www.rpa-solutions.com/stockist/index.phps
<p>Please enter a county to search: <input type=\"text\" name=\"search\" <?php echo \"value=\'$search\'\"?>>
<input type=\"submit\" name=\"Search\" value=\"Find\"></p>
<p>
<?php
$db = mysql_connect($host, $user, $pass);
mysql_select_db($database) or die(mysql_error());
$error = \"<p>Sorry there is no match for this county</p>\";
// echo\"search=\". $search; // debug!
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_row($result)) {
while ($myrow = mysql_fetch_row($result)) {
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]);
}echo \"</table>\";
} else {
echo $error;
}
}
?>