Jump to content

[SOLVED] Counting a field


Nexy

Recommended Posts

Why Hello There!  :) Just an idea I had, need some help on how to do it. The following is a layout:

 

Let's say I have a row named newsid. How would I make a query where it selects newsid with the value of a certain a number(the number comes from another table.). Then display a number saying you have "9" fields that match newsid with the number.

 

The 9 is just an example. Did I make sense? Any help would be appreciated.

 

Thank You!  :)

Link to comment
https://forums.phpfreaks.com/topic/109325-solved-counting-a-field/
Share on other sites

Sorry, I meant to say column. And I think you misunderstood me.

 

Maybe this will help:

 

| id | newsid | content |

------------------------

| 1 |    3    |  Test1  |

| 2 |    3    |  Test2  |

| 3 |    3    |  Test3  |

------------------------

 

I just want it to echo "You have 3 rows where newsid = 3". It could be more or less. Thank You!

 

 

EDIT: Actually, nevermind, I misread your post. Thank You it worked.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.