me1000 Posted July 11, 2007 Share Posted July 11, 2007 Is there a PHP function that counts the number of time something appears in a MySQL query? So I run the query, and it finds the number of times " " is found in the returned results. Quote Link to comment Share on other sites More sharing options...
marcus Posted July 11, 2007 Share Posted July 11, 2007 Something like: $sql = "SELECT * FROM `tbl_name` WHERE `field_name` LIKE '% %'"; $res = mysql_query($sql) or die(mysql_error()); echo mysql_num_rows($res); ?? Quote Link to comment Share on other sites More sharing options...
me1000 Posted July 11, 2007 Author Share Posted July 11, 2007 That gives me back the number of entries with ' ' in it. I just need to find the number of times ' ' is found within one entry Quote Link to comment Share on other sites More sharing options...
me1000 Posted July 11, 2007 Author Share Posted July 11, 2007 ok I think i have it, $pages = explode(" ", $info); foreach ($pages as $v) { $i++; } echo $i-1; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.