This is a discussion on "[SOLVED] Count something in MySQL Table?" within the PHP Forum section. This forum, and the thread "[SOLVED] Count something in MySQL Table? are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
[SOLVED] Count something in MySQL Table?
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
||||
|
[SOLVED] Count something in MySQL Table?
Hi guys,
I'm building my own blog system to try and learn PHP. I have a comments table, where each comment has an ID, which relates to the ID of the article. Example: Comments on Article No.1 have an ID of 1. I want to count how many comments (IE, rows with ID=(ARTICLE ID)) so, if the article id=1, then I want to count the number of rows with the ID of 1. How can I do this? Do you understand what I am saying? Jack
__________________
Resources Administrator
Grilling Gurus - Interviews with the Best Web Designers and Developers in the Industry Got a Question for Ryan Carson and his Web Design/Development team Carsonified? Jack Franklin - My Blog (It's a Pen in My Mouth BTW)
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
|
|
|
|
|||
|
Re: Count something in MySQL Table?
I'm no expert and someone will probably give you a better answer but something like this might work
Pat |
|
||||
|
Re: Count something in MySQL Table?
Typo in that code.. this should work.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
||||
|
Re: Count something in MySQL Table?
From looking at the code that seems absolutely pefect for the job. If I change it to
I'll try it and get back to you. Thanks for the response.
__________________
Resources Administrator
Grilling Gurus - Interviews with the Best Web Designers and Developers in the Industry Got a Question for Ryan Carson and his Web Design/Development team Carsonified? Jack Franklin - My Blog (It's a Pen in My Mouth BTW)
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
|
|
||||
|
Re: Count something in MySQL Table?
It will still work as long as you have a variable called $articleid.
|
|
||||
|
Re: Count something in MySQL Table?
Ok thanks. SOLVED
(For now anyway, might return if it fails :P) Thanks, as usual, for the fantastic help Jack
__________________
Resources Administrator
Grilling Gurus - Interviews with the Best Web Designers and Developers in the Industry Got a Question for Ryan Carson and his Web Design/Development team Carsonified? Jack Franklin - My Blog (It's a Pen in My Mouth BTW)
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [SOLVED] Post Count Not Going Up... | TheLion | Webforumz Cafe | 1 | Jan 16th, 2008 09:57 |
| [SOLVED] Page count? | unitedcraig | JavaScript Forum | 11 | Nov 7th, 2007 07:07 |
| Viewing the contents of a table in MySQL | nemmea | Databases | 3 | Sep 6th, 2007 22:01 |
| MySQL UPDATE after use $uniqueID to find table row, etc | jswebdev | PHP Forum | 1 | Dec 6th, 2005 12:09 |