RE: [PHP] return the amount of records in a mysql databace
select count(*) as n from ... where ... -Original Message- From: Philip J. Newman [mailto:[EMAIL PROTECTED]] Can someone point me in the right direction to find out how i can return the amount of records in a mysql databace ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] return the amount of records in a mysql databace
this is only going to return records in a table, and not in a database select count(*) as n from ... where ... -Original Message- From: Philip J. Newman [mailto:[EMAIL PROTECTED]] Can someone point me in the right direction to find out how i can return the amount of records in a mysql databace ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] return the amount of records in a mysql databace
Look through the MySQL functions. I seem to recall that there is a function for just about anything, and all you really want to do is find how many rows are in all the tables in a particular database. Thus, a couple of loops is all you need, with the outer one looping through each table (obtained from a function) and the inner one doing a select count(*) or a mysql_num_rows(). Happy hacking. Chris Jeff Bluemel wrote: this is only going to return records in a table, and not in a database select count(*) as n from ... where ... -Original Message- From: Philip J. Newman [mailto:[EMAIL PROTECTED]] Can someone point me in the right direction to find out how i can return the amount of records in a mysql databace ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] return the amount of records in a mysql databace
?php $sql = SELECT count(*) FROM stompers WHERE 1; $sql_result = mysql_query($sql, $connection) or die (Could not get Query); $row = mysql_fetch_array($sql_result); $sUsers=$row[count(*)]; echo brWe have b$sUsers/b registered users.; ? This would be the best way (suggestions would be cool); - Original Message - From: Mark Charette [EMAIL PROTECTED] To: Philip J. Newman [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, September 23, 2002 1:28 AM Subject: RE: [PHP] return the amount of records in a mysql databace select count(*) as n from ... where ... -Original Message- From: Philip J. Newman [mailto:[EMAIL PROTECTED]] Can someone point me in the right direction to find out how i can return the amount of records in a mysql databace ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] return the amount of records in a mysql databace
Then do a SHOW DATABASES query before that and loop through the results, counting the rows in each table. If you have to do this, though, I think you have some normalization issues with your database... ---John Holmes... -Original Message- From: Jeff Bluemel [mailto:[EMAIL PROTECTED]] Sent: Sunday, September 22, 2002 11:46 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] return the amount of records in a mysql databace this is only going to return records in a table, and not in a database select count(*) as n from ... where ... -Original Message- From: Philip J. Newman [mailto:[EMAIL PROTECTED]] Can someone point me in the right direction to find out how i can return the amount of records in a mysql databace ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] return the amount of records in a mysql databace
select count(*) as n from ... where ... This worked well for me. - Original Message - From: John Holmes [EMAIL PROTECTED] To: 'Jeff Bluemel' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, September 23, 2002 1:28 PM Subject: RE: [PHP] return the amount of records in a mysql databace Then do a SHOW DATABASES query before that and loop through the results, counting the rows in each table. If you have to do this, though, I think you have some normalization issues with your database... ---John Holmes... -Original Message- From: Jeff Bluemel [mailto:[EMAIL PROTECTED]] Sent: Sunday, September 22, 2002 11:46 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] return the amount of records in a mysql databace this is only going to return records in a table, and not in a database select count(*) as n from ... where ... -Original Message- From: Philip J. Newman [mailto:[EMAIL PROTECTED]] Can someone point me in the right direction to find out how i can return the amount of records in a mysql databace ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php