The parse error is returned:
Parse error: parse error in c:\inetpub\wwwroot\Wendy\searchyouthservices.php on line 23
If I remove the 'else' function it works but the 'sorry no matches' message is returned even when there are matches.
Here's my code:
<?php
mysql_connect ("localhost", "root", "purple1");
mysql_select_db ('youth_services');
$search=$_POST["search"];
$result = mysql_query("SELECT * FROM details WHERE org LIKE '%$search%'");
while($r=mysql_fetch_array($result))
{
$org=$r["org"];
$address1=$r["address1"];
$city=$r["city"];
$pcode=$r["pcode"];
$tel=$r["tel"];
$email=$r["email"];
echo "$org <br> $address1 <br> $city <br> $pcode <br> $tel <br> $email <br>";}
else {echo "Sorry, no results found";
}
?>
I can't figure out what is wrong with having 'else' there.
Anyone got any suggestions?
Many thanks