Counting new entries

wxdqz

New Member
Here is my script that i am using:

<?PHP
$login="loafer";
$pass ="rizzla";
$db=mysql_pconnect("localhost",$login,$pass);
mysql_select_db("loafers_ie",$db);

$curDate = getdate();
$month = $curDate[mon];
$day = $curDate[mday];
$year = $curDate[year];
if($month < 10) $mon = "0".$month;
if($mday < 10) $mday = "0".$day;

MySQL_select_db($db_name,$db);
$sql="select *, count(*) from Photos where dayofmonth(New) >= $mday and month(New) >= $mon group by EventName having count(*)>0 ORDER by EventName ASC";

$result=MySQL_query($sql,$db) or die("Bad query:".mysql_error());

while($myrow=MySQL_fetch_array($result))

{
$ID=$myrow["ID"];
$EventName=$myrow["EventName"];

echo "<FONT Class='text-mail'>$EventName (New)<BR>";

}
?>

What i want to do is count and display the amount of new photos that have the same EventName so that the results are similar to as follows:

$EventName ($Count New)
Linirick (5 New)

I have gotten to split it down to event names but i cant show how many are new.
 
Back
Top