HI ! Again me !
I have a search code with name search.php
****** begin code
<HTML>
<?php
$searchstring=$_GET['searchstring']
if ($searchstring)
{
$db=mysql_connect("localhost","root","") ;
mysql_select_db("test",$db) ;
$sql=" select * from personnel where $searchtype like '%$searchstring%' order by firstname ASC";
$result=mysql_query($sql,$db) ;
echo "<TABLE BORDER=2>" ;
echo "<TR><TD><B>Full Name</B><TD><B>Nick Name</B><TD>Options<B></B></TR>" ;
while ($myrow=mysql_fetch_array($result))
{
echo "<TR><TD>".$myrow["firstname"]."".$myrow["nick"] ;
echo "<TD><a ref=\"view.php?id=".$myrow["id"]."\" >View</a>" ;
}
echo "</TABLE>" ;
}
else
{
?>
<form method="POST" action="<?php $PHP_SELF ?>">
<table broder="2" cellspacing="2">
<tr><td>Insert your search string here</td>
<td>Search type</td></tr>
<tr>
<td><input type="text" name="searchstring" size="28"></td>
<td><select size="1" name="searchtype">
<option value="firstname" selected>First name</option>
<option value="lastname">Last name</option>
<option value="nick">Nick name</option>
<option value="email">Email</option>
</select>
</td>
</tr>
</table>
<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset"></p>
</form>
<?
}
?>
</HTML>
**********end code
when i browse it "http://localhost/search.php" i get an error :
"Parse error: parse error, unexpected T_IF in C:\Inetpub\wwwroot\search.php on line 4" ...something i swrong on the line "if ($searchstring)"
Thanks !
Search code
Moderator: General Moderators
-
alina_costin
- Forum Newbie
- Posts: 5
- Joined: Fri Mar 05, 2004 1:02 am
- Location: Romania
- Contact: