Hi, I was wondering if I could please get some help or ideas on how to accomplish this task that I have been working on for a few days now.
What I want to do is have an html page where you enter an IP adddress and it will search two mysql databases for entries of the IP.
IE enter 192.168.1.1
search both sql1db and sql2db and spit out the entire row. Which is made up of IP, Timestamp, date, alertname, iphhdr
here is the code that I currently have. I am new to mysql and php so if my coding is bad please bare with me.
$host = "localhost";
$user = "test";
$pass = "test";
$dbname = "IPalert";
$connection = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>");
// This command will perform the query
$query= "select * from signature where sig_name= '" . $_POST['IP'] . "'";
//this will try to spit out the previous sql query
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
//this is a line break before the spit output
while ($line = mysql_fetch_row($result) )
now here are where I am stuck. When when I run the query I get the correct results, but how do I show the name of each of the columns in the tables. Instead of just showing the results line by line. Also how to I make my script at the same time also search another database on the same machine.
thanks very much for the help in advance.
If you have any questions please feel free to ask.