Php - Get total number of rows from mysql table, Count the rows or data in mysql table


Get total number of rows from mysql table

The below code will help you to get the total number of rows from the mysql table. It will just print the number of rows of a table.

<?php

$link = mysql_connect("localhost", "mysql_user", "mysql_pass");
mysql_select_db("database", $link);

$result = mysql_query("SELECT * FROM table1", $link);
$num_rows = mysql_num_rows($result);

echo "$num_rows Rows\n";

?>


Php - Count the rows or data in mysql table
The topic on Php - Get total number of rows from mysql table is posted by - Math
Hope you have enjoyed, Php - Get total number of rows from mysql table . Thanks for your time.

All rights reserved. © www.w3calculator.com