Debt Consolidation - Free Advertising - Loans - Gas Suppliers - Electricity Suppliers

PDA

View Full Version : Easy query question


Jakobi
May 3rd 2007, 11:06 pm
Hello,

I am new to this but here is the question.

I have this query that counts rows in my database.

SELECT Count() FROM `files` WHERE `added`=current_date

Which works.

Now what is the standard php code that would display that?

Thanks.

Kalyse
May 4th 2007, 11:02 am
This is possibly the longest way of doing it, but its the simplest way to follow

$query = "SELECT Count(*) as `count` FROM `files` WHERE `added`=current_date";
$result = mysql_query($query);
$row = mysql_fetch__row($result);
$count = $row['count'];
echo $count;