I am trying to get a form to look in the MySQL Database and look up an IP address that is stored there.
I read through some materials and figured that I would have a simple search that when you enter just the first 2 sets of numbers, it would then submit the query to itself and display a list of matching IP's underneath the search box.
This function is an imporatant one in our admin area.
However all it is doing is just displaying the table, but no results for entries I KNOW should match, such as mine 🙁
I think it is a type conversion problem of some sorts, but i am not sure how to fix it.
Here is my code I have so far-
IF (isset($search)) {
print ("
<br><br>
<center><font size='5'><font color='red'>IP SEARCH RESULTS:</font></center>
<br>
<br>
<TABLE ALIGN='center' BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH='100%'>
<TR ALIGN='left' VALIGN='middle'>
<TR ALIGN='left' VALIGN='middle'>
<TD><font color='blue'><b><u>Member Name</b></u></font></TD>
<TD><font color='orange'><b><u>IP Address</b></u></font></TD>
<TD><font color='purple'><b><u>Last Login</b></u></font></TD>
</TR>
<TR ALIGN='left' VALIGN='middle'>
<TD> </TD>
<TD> </TD>
<TD> </TD>
</TR>
");
#########################
Connect to Database
#########################
$Link1 = mysql_connect($Host, $User, $Password);
mysql_select_db($DBName, $Link1);
$Query1 = "SELECT* from $TableName1 WHERE ip LIKE '$search%'";
$Result1 = mysql_query($Query1, $Link1);
$Array1 = mysql_fetch_array($Result1);
###################################
## Loop through Possible Results ##
###################################
While ($Array1 = mysql_fetch_array($Result1)) {
print("
<TR ALIGN='left' VALIGN='middle'>
<TD><font color='blue'>$Array1[user]</font></TD>
<TD><font color='orange'>$Array1[ip]</font></TD>
<TD><font color='purple'>$Array1[lastlogin]</font></TD>
</TR>
");
}
print ("</TABLE></body>");
exit; }
?>
Now then, is this a type conversion problem like I thought? I stored the $REMOTE_ADDR as a TEXT type in the MySQL Database, and I know it is there, since I am looking at it right now in the database. I thought that if I stored it as a TEXT Type, then PHP would interpret it as TEXT. I tried everything I could think of, but no dice 🙁.
If it is indeed