Hello all,
First off, i'm starting to learn PHP so excuse me if my quetion wasn't up to the level.
Anyway, I have setup spam filtering server that runs mysql in the backend. I want to send my clients the total amount of spam messages and virus messages they are getting a month.
here is the script:
Code:
<?php
// Building mysql connection
$con = mysql_connect("localhost","root","mypass");
if (!$con)
{
die ('Could not connect:' . mysql_error());
}
// Selecting Database
mysql_select_db("mailscanner", $con);
$allmail = mysql_query("SELECT COUNT(*) FROM maillog WHERE to_domain="mydomain.com" AND MONTH(date) = MONTH(CURRENT_DATE)");
//Printing output
echo $allmail;
mysql_close($con);
?>
For some reason, the script is not giving any output. under MySQL shell, i have tested the query inclused into $allmail variable. i have also tested the above PHP script with simpler mysql and it works fine.
I need to learn from you guys ... any help will be highly appreciated.
Regards;
|