Re: Regarding split text and match from data base [message #183909 is a reply to message #183843] |
Mon, 25 November 2013 06:09 |
jalaf28
Messages: 8 Registered: November 2013
Karma:
|
Junior Member |
|
|
i found the solutio.but its not work properly. because it prints the Ip and System name but no correct.
here is the code what should i do?
<?php
$out=shell_exec("arp -a");
$ex=explode(" ",$out);
$j=21; // variable used for Ip address
$k=32; // varibale used for MAC Address
$ln=mysql_connect("localhost","root","");
if(!$ln)
{
die("Could not Connect to The Server");
}
mysql_select_db("mysql") or die("Could Not Connect with database");
$rs=mysql_query("select * from mac_add");
echo "<center><table border=1><tr><th>Ip</th><th>System Name</th></tr>";
while($rr=mysql_fetch_array($rs))
{
if($rr[0] == $ex[$k])
{
//echo $ex[$j] . " " . $rr[0] . "<br />";
echo "<tr><td>" .$ex[$j] . "</td><td>" . $rr[0] . "</td> </tr>";
}
$j +=21;
$k +=21;
}
echo "</table></center>";
?>
its not matching [Comapare with the MAc in the Database]
what should i Do ?
|
|
|