Page 1 of 1

[SOLVED] Count rows and produce an integer

Posted: Sun Aug 22, 2004 2:31 pm
by ripcurlksm
Hello all, Im new to the board....

I have a status table which can hold the values sold or selling, I want to do a count of how many items are currently selling and produce an integer as a result.

EX:

Items Selling: 3

Here is the start of my query:

Code: Select all

$result = mysql_query("SELECT bookmark, COUNT(*) as ??? FROM status WHERE status='selling' ");

echo "Items Selling: ???";

Posted: Sun Aug 22, 2004 2:56 pm
by feyd

Code: Select all

$query = mysql_query('SELECT COUNT(bookmark) FROM status WHERE status = ''selling''') or die(mysql_error());
list($count) = mysql_fetch_row($query);

echo 'Items Selling: ' . $count;

Posted: Sun Aug 22, 2004 6:51 pm
by ripcurlksm
Thanks!