php - Print number of records in a table? -


how print number of records in mysql table?

modified php: mysql_result

<?php  $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); if (!$link) {     die('could not connect: ' . mysql_error()); } if (!mysql_select_db('database_name')) {     die('could not select database: ' . mysql_error()); } $result = mysql_query('select count(*) mytable'); if (!$result) {     die('could not query:' . mysql_error()); } $rowcount = mysql_result($result, 0); // count echo $rowcount; // echo count  mysql_close($link); ?> 

check out php mysql functions if you're getting started. if you're using kind of framework, check out database documentation framework.


Comments

Popular posts from this blog

delphi - TJvHidDeviceController "DevicePath" always showing "\" -

Disabling Android home button for industry application -

asp.net mvc 3 - Unexpected "foreach" keyword after "@" character -