Okay, I made a search form...
while($r=mysql_fetch_array($result)) {
$blah=$r["name"];
echo $blah;
echo "<br>";
}
that code works when you hit search, but when I put
while($r=mysql_fetch_array($result)) {
$blah=$r["name"];
echo $blah;
echo "<br>";
} else {
echo "No search results.";
}
it gives me on error and says parse error on the line with
} else {
help please ! thankyou
while problem
Moderator: General Moderators
Well, it's not an if statement, so what you need to do is make an if checking if the search variable is set, so if your search variable was $search you do somethin like
Code: Select all
<?php
if (isset($search)) {
while($r=mysql_fetch_array($result)) {
$blah=$r["name"];
echo $blah;
echo "<br>";
}
} else {
echo "No search results.";
}
?>