fr34k2oo4 Posted January 21, 2009 Share Posted January 21, 2009 He guys, I've been searching the net for this piece of code, but I just can't figure it out. I'm not very good at PHP just got to the basics. I'm making a webpage for a small company. So I made some question to make it easier for me. There are some organisations involved and the are in categories so now I want to check how many organisations are in the specified categorie. So I only need a script that first checks and filters the categorie and then checks how many organisations are in this categorie. quite some story still I hope someone can help me. Greetings, F2k4 Link to comment https://forums.phpfreaks.com/topic/141767-stuck-already-s/ Share on other sites More sharing options...
MadTechie Posted January 21, 2009 Share Posted January 21, 2009 I assume this data is a MySQL Database.. if so it would be helpful to see some sample data and the structure Link to comment https://forums.phpfreaks.com/topic/141767-stuck-already-s/#findComment-742122 Share on other sites More sharing options...
fr34k2oo4 Posted January 21, 2009 Author Share Posted January 21, 2009 I'm using a mySQL database. I'm backwards engineering, and working on the code (which I need a lil' help with) I still don't have a usefull way of defining a category, I think a case or switch would do. I'm using the mySQL field "oCat" (wich will contain a category number. ex: 1 = Health, 2 = Psychiatry, etc.) now I would like to filter Health from this table and let php count the amount of rows it uses in the database. so I'd suppose a num_rows would do the trick but how... I have no clue So sorry, I can't really give any examples yet... Link to comment https://forums.phpfreaks.com/topic/141767-stuck-already-s/#findComment-742141 Share on other sites More sharing options...
lonewolf217 Posted January 21, 2009 Share Posted January 21, 2009 $sql = mysql_query("SELECT * from <database> where oCat = 1") $rows = mysql_num_rows($sql) assuming here you meant show only this category, but you can alter it as you need to Link to comment https://forums.phpfreaks.com/topic/141767-stuck-already-s/#findComment-742155 Share on other sites More sharing options...
fr34k2oo4 Posted January 21, 2009 Author Share Posted January 21, 2009 thanks, suppose that the 1 in: ... oCat = 1") stand for the number of the categorie? thanks show that I'm still a rookie. Solved! Link to comment https://forums.phpfreaks.com/topic/141767-stuck-already-s/#findComment-742158 Share on other sites More sharing options...
lonewolf217 Posted January 21, 2009 Share Posted January 21, 2009 that is correct Link to comment https://forums.phpfreaks.com/topic/141767-stuck-already-s/#findComment-742170 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.