i8igmac Posted July 22, 2015 Share Posted July 22, 2015 So, im working on a database driven webpage... a pretty basic setup, search bar with pagination style results... i understand the concept of pagination, but php is kinda goofy at times... im struggling with pulling "SELECT COUNT(Name) FROM places" from the database with php as a value i can perform some math... how can i pull this from the database as a direct string???? $pagination = ($db -> select("SELECT COUNT(Name) FROM `places`")); echo serialize($pagination); :1:{i:0;a:1:{s:11:"COUNT(Name)";s:2:"155";}}155 is the data i need... here is how i have decided to use the database... http://www.binpress.com/tutorial/using-php-with-mysql-the-right-way/17 example from the site below... $db = new Db(); $rows = $db -> select("SELECT `name`,`email` FROM `users` WHERE id=5"); Quote Link to comment Share on other sites More sharing options...
cooper Posted July 22, 2015 Share Posted July 22, 2015 Wouldn't your query produce 1 row with 1 column where "COUNT(Name)" is the column name and "155" is the value? If, per the example, $rows is what's produced, wouldn't $rows[0] (or some such) contain the value of the first column? 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.