$db = "Netplexer"; // Here name of the database
$link = mysql_connect("localhost","root","" ); // Setp 1 , connection... .
// here I use default setting of Mysql database
if ( ! $link )
die( "Couldn't connect to MySQL" ); // error massage
mysql_select_db( $db, $link ); // Step 2 , select database
or die ( "Couldn't open : ".mysql_error() );
COUNT(DST_IP) AS NumOccurrences
FROM IncomingTraffic
GROUP BY DST_IP
HAVING ( COUNT(DST_IP) > 1 )
ORDER BY NumOccurrences DESC";
// here we can use Select , Insert , drop , etc ..
$result=mysql_query( $query) or die (mysql_error());
$i=0;
while($row=mysql_fetch_array($result)) // separate data using arrays
{
$data []= $row['NumOccurrences'];
$dataIP []= $row['DST_IP'];
}
mysql_close( $link ); // Step 4 , Close