PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 22nd, 2004, 03:31 PM
ripcurlksm ripcurlksm is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 4 ripcurlksm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 27 m 8 sec
Reputation Power: 0
Count rows and produce an integer

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:


PHP Code:
 $result mysql_query("SELECT bookmark, COUNT(*) as ??? FROM status WHERE status='selling' ");
 
 echo 
"Items Selling: ???"

Reply With Quote
  #2  
Old August 23rd, 2004, 06:13 AM
kode_monkey kode_monkey is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 367 kode_monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 21 sec
Reputation Power: 6
Make the sql 'COUNT(*) AS cnt'

Then $obj = mysql_fetch_object ($result);

Then you have access to $obj->cnt for displaying it.

Hope this helps,

-KM-

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Count rows and produce an integer


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT