Posted: Wed Jan 03, 2007 9:37 pm
Once again,
I attempted, and failed..
The code
Neither of the IF statements for num_rows work, how can I make them.
I really appreciate you guys telling me what to do.
Thanks!
I attempted, and failed..
The code
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);
$ip = mysql_real_escape_string($_GET['ip'], $connection2);
$sql4 = "SELECT * FROM `sn_lookup` WHERE IP ='$ip' ORDER BY `ID` DESC";
$result4 = mysql_query($sql4) or die(mysql_error());
$num_rows = mysql_num_rows($result4);
if ($num_rows = 0){echo "No SN found for that IP";}
?>
<style type=text/css>
table tr.odd{
background-color:gray;}
table tr.odd:hover{
background-color:#CCFFCC;}
a{
color:white
}
</style>
<?
if ($num_rows > 0){echo '
<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>
<?
};
?>I really appreciate you guys telling me what to do.
Thanks!
