a simple search, got error,Anyone please?
Posted: Sat Apr 05, 2003 4:07 pm
I have made a search page using one of the table of my db( there are two tables in my db), and gradually learn some about php/mysql searching.
now I get an error which i can't figure it out what is wrong, I appreciate if you take a look at my code, and see what is wrong with it.
If you think I could use a better code for search my db, please feel free to post, your effort is appreciated.
i get this error:
Parse error: parse error, unexpected T_ELSE in c:\inetpub\wwwroot\test.php on line 48
and this is on line 48: else {
and this the last "else" on the code page:
Code: Select all
<html>
<body>
<?php
if($submit);{
# Type="MYSQL"
# HTTP="true"
$hostname_conn_amasys = "localhost";
$database_conn_amasys = "mytestMarch15";
$username_conn_amasys = "mytestpage";
$password_conn_amasys = "789456";
$conn_amasys = mysql_pconnect($hostname_conn_amasys, $username_conn_amasys, $password_conn_amasys) or die(mysql_error());
?>
<?php
$query="SELECT*FORM company WHERE LOWER (company_name) LIKE LOWER ( '%$keyword%') OR LOWER(job_title) LIKE LOWER('%$keyword%') ORDER BY id DESC";
$result=mysql_query($query);
if($myrow=mysql_fetch_array($result)){
echo"<br><b> Search results for: </b><u>$keyword</u><br>";
echo"<ol>";
do{
echo "<li>".$myrow["company_name"]."";
}while ($myrow=mysql_fetch_array($result));
echo "</ol><br>";
?>
<div align="center">
<form method="psot" action="submit" value="search">
<table calss = "columns" align="center">
<tr><td>
<b> Search The Archive:</b><input type="text" name="keyword" size="15">
<input type="submit" name="submit" value="g0>
</td></tr></table></div></form>
<?php
}
else{
echo "<br><b> NO Records Found for:</b><u>$keyword</u><br>";
?>
<div align ="center">
<form method="post" action="search123.php">
<input type="hidden" name="submit" value="search">
<table calss="columns" align="center">
<tr><td>
<b> Search:</b><input type="text" name="keyword" size="15">
<input type="submit" name="submit" value="g0>
</td></tr></table></div></form>
<?
}
}
else { // this is line 48
?>
<div align="center">
<form method="post" action="search123.php">
<input type="hidden" name="submit" value="search">
<table calss="columns" align="center">
<tr><td>
<b> Search The Archive:</b>
<input type="text" name="keyword" size="15">
<input type="submit" name="submit" value="g0>
</td></tr></table></div></form>
<?php }
?>
</body>
</html>thanks a lot.