JukEboX Posted May 1, 2008 Share Posted May 1, 2008 THis is a newbish question but I would like to know how to count certain records and show the final amount with. I want it to count the records that are marked Y. Using PHP and Mysql Link to comment https://forums.phpfreaks.com/topic/103775-counting/ Share on other sites More sharing options...
JD* Posted May 1, 2008 Share Posted May 1, 2008 In the SQL statement, do SELECT COUNT(Y) from database Link to comment https://forums.phpfreaks.com/topic/103775-counting/#findComment-531298 Share on other sites More sharing options...
JukEboX Posted May 2, 2008 Author Share Posted May 2, 2008 Ok that help. I need it to count the records where the Test field is marked y. would it be $count1="SELECT COUNT(y) from table WHERE Test='y'" ? Link to comment https://forums.phpfreaks.com/topic/103775-counting/#findComment-531380 Share on other sites More sharing options...
ohdang888 Posted May 2, 2008 Share Posted May 2, 2008 yes Link to comment https://forums.phpfreaks.com/topic/103775-counting/#findComment-531399 Share on other sites More sharing options...
JukEboX Posted May 2, 2008 Author Share Posted May 2, 2008 ok so then my show should look like <?php $count ?> right? Link to comment https://forums.phpfreaks.com/topic/103775-counting/#findComment-531422 Share on other sites More sharing options...
JukEboX Posted May 2, 2008 Author Share Posted May 2, 2008 Cuase that last post is not working. Link to comment https://forums.phpfreaks.com/topic/103775-counting/#findComment-531432 Share on other sites More sharing options...
JD* Posted May 2, 2008 Share Posted May 2, 2008 No, it would be more like: $result = mysql_query("SELECT COUNT(y) AS count from table WHERE Test='y'"); echo mysql_result($result, 0, "count"); Link to comment https://forums.phpfreaks.com/topic/103775-counting/#findComment-531453 Share on other sites More sharing options...
ohdang888 Posted May 2, 2008 Share Posted May 2, 2008 Jukebox, just for future reference, its best for everyone when, instead of asking "would this work" to first try it out on your site, and then report back the errors. Link to comment https://forums.phpfreaks.com/topic/103775-counting/#findComment-531729 Share on other sites More sharing options...
JukEboX Posted May 2, 2008 Author Share Posted May 2, 2008 THat worked. Thanks so much. Link to comment https://forums.phpfreaks.com/topic/103775-counting/#findComment-531751 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.