Search Database Script - not working - simple mistake [56kw]
Posted: Wed Jan 03, 2007 8:19 pm
Hello,
I have created a script that looks up information in a database, that is inputted on a form. If there is nothing inputted, it will show a form instead of information from the database. I cant figure out where the error is, I know its really simple but I just cant figure it out, or see it.
Dont get angry becasue I know this is such a stupid mistake
snlookup.php
The error I get is
thanks alot!!!
I have created a script that looks up information in a database, that is inputted on a form. If there is nothing inputted, it will show a form instead of information from the database. I cant figure out where the error is, I know its really simple but I just cant figure it out, or see it.
Dont get angry becasue I know this is such a stupid mistake
snlookup.php
Code: Select all
<?
if ($_GET['ip']) {
$username2= "muot_report";
$password2= "pass";
$database2= "muot_report";
$ip= $_GET['ip'];
$connection2 = mysql_connect('localhost',$username2,$password2);
mysql_select_db($database2);
$sql4 = "SELECT * FROM `sn_lookup` WHERE IP =".$_GET['ip']." ORDER BY `ID` DESC";
$result4 = mysql_query($sql4) or die(mysql_error());
?>
<style type=text/css>
table tr.odd{
background-color:gray;}
table tr.odd:hover{
background-color:#CCFFCC;}
a{
color:white
}
</style>
<table border=0 width=500>
<tr><td><b>ID/IP</b></td><td><b>SN</b></td></tr>
<?
};
while($row4 = mysql_fetch_array($result4)) {
echo "<tr class=odd>";
echo "<td align=left width=100 valign=top><font size=2>".$row4['ID']."</font><br><font size=1>".$row4['IP']."</font></td>";
echo "<td align=left><font size=2>".$row4['SN']."</font></td>";
} mysql_close($connection2);
else {
?>
<form action=/snlookup.php method=get>
Enter the IP address - <input type=text name=ip><br><input type=submit value="Look Up">
</form>
<?
};
?>Told ya it was easy!!
Parse error: parse error, unexpected T_ELSE in /home/muot/public_html/snlookup.php on line 32
thanks alot!!!