jaminxz Posted February 25, 2009 Share Posted February 25, 2009 Hello, I have a sql join query which returns a set of records. I need to know how many records are returned, so i guess I need to use COUNT(!) somehow but i dont quite know how. Any suggestions would be warmly welcomed! SELECT ID, t1.AD_No, LineNo, t2.Description, t2.CyclesLimit, t2.HourLimit, t2.DateLimit, t1.CompMethod, t1.Comments, STATUS, (!COUNT_OF_RESULTS!) FROM foo as t1 LEFT OUTER JOIN ad_item as t2 ON t1.AD_No= t2.AD_No WHERE OPEN=1 AND STATUS=1 ORDER BY AD_No, LineNo Link to comment https://forums.phpfreaks.com/topic/146849-solved-sql-count-on-results/ Share on other sites More sharing options...
HuggieBear Posted February 25, 2009 Share Posted February 25, 2009 From within PHP or not? Regards Rich Link to comment https://forums.phpfreaks.com/topic/146849-solved-sql-count-on-results/#findComment-771014 Share on other sites More sharing options...
jaminxz Posted February 25, 2009 Author Share Posted February 25, 2009 yeah sorry. I'm trying to build a table with paging so I need to know how many pages to have. Link to comment https://forums.phpfreaks.com/topic/146849-solved-sql-count-on-results/#findComment-771044 Share on other sites More sharing options...
HuggieBear Posted February 25, 2009 Share Posted February 25, 2009 Use mysql_num_rows() on the results resource you get from mysql_query() Regards Rich Link to comment https://forums.phpfreaks.com/topic/146849-solved-sql-count-on-results/#findComment-771046 Share on other sites More sharing options...
jaminxz Posted February 25, 2009 Author Share Posted February 25, 2009 ah yeah this should, work. thanks. Link to comment https://forums.phpfreaks.com/topic/146849-solved-sql-count-on-results/#findComment-771103 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.