genesisvh
asked on
Error in php search form
I'm getting an error in my php script. It has to do with the else on line 38. Can anyone see what the problem is.
<?php
$con = mysql_connect("localhost","","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("", $con);
$query = mysql_query("SELECT description, cross_streets, title, town, feeornofee, lease, phone, contact, office, email, rent FROM apartments WHERE description LIKE '%$search%' ¦¦ cross_streets LIKE '%$search%' ¦¦ title LIKE '%$search%' ¦¦ town LIKE '%$search%' ¦¦ feeornofee LIKE '%$search%' ¦¦ lease LIKE '%$search%' ¦¦ phone LIKE '%$search%' ¦¦ contact LIKE '%$search%' ¦¦ contact LIKE '%$search%' ¦¦ office LIKE '%$search%' ¦¦ email LIKE '%$search%' ¦¦ rent LIKE '%$search%'", $db);
if ($query)
{
echo "<table width=100% border=0 cellpadding=0 cellspacing=5 class=border_playlist_table><tr>";
while ($myrow = mysql_fetch_array($query)) { // Begin while
$title = $myrow["title"];
$town = $myrow["town"];
$contact = $myrow["contact"];
$office = $myrow["office"];
$phone = $myrow["phone"];
$rent = $myrow["rent"];
echo "<tr class=sub_1><td colspan=4>$title : $town</td></tr>
<tr bgcolor=#55556F><td><p><a href=$url target=_blank>$url</a></p></td>
<td><p>$title</p></td>
<td><p>$town</p></td>
<td><p>$contact</p></td></tr>
<tr bgcolor=#55556F><td colspan=4>$office</td></tr>
<tr bgcolor=#55556F><td colspan=4>$phone</td></tr>
<tr><td colspan=4> </td></tr>";
} // end while
echo "</tr></table>";
}
else {
echo "problems....";
}
else{
echo "Search string is empty. <br> Go back and type a string to search";
}
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER