Nexy Posted June 8, 2008 Share Posted June 8, 2008 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 More sharing options...
Barand Posted June 8, 2008 Share Posted June 8, 2008 Let's say I have a row named newsid rows don't have names. This will give the number of rows where the column "newsid" = 9 SELECT COUNT(*) FROM tablename WHERE newsid = 9 Link to comment https://forums.phpfreaks.com/topic/109325-solved-counting-a-field/#findComment-560780 Share on other sites More sharing options...
Nexy Posted June 9, 2008 Author Share Posted June 9, 2008 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. Link to comment https://forums.phpfreaks.com/topic/109325-solved-counting-a-field/#findComment-560800 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.