PHP Coding for Row and Column count

This is count  number of rows and column  in table.the single line can be count a table rows this is count a rows  and column of your's calculate a rows and  column .finally display  a how many  rows  and column presents in your table .

Row Count

$row_count= mysql_query("SELECT * FROM comments", $conn);
echo mysql_num_rows($row_count);

Column Count:

$count_column = mysql_query("SELECT * from comments WHERE id = '1'");
echo mysql_num_fields($count_column);

Source code:

<title>Php coding for count table rows</title>
$conn= mysql_connect("localhost", "root", "");
mysql_select_db("demo", $conn);
//Row Count
$row_count= mysql_query("SELECT * FROM comments", $conn);
$rows= mysql_num_rows($row_count);
echo " No. of Rows  (".$rows.")<br>";
//Column Count
$column_count = mysql_query("SELECT * from comments WHERE id = '1'",$conn);
$column= mysql_num_fields($column_count);
echo "No. of Columns  ( ".$column.")";


No. of Rows (4 )
No. of column (3)