How do i get the mysql_num_rows from a php function; i wish to use the extracted number with my page pagination.
i know that if i do the following i will get the num rows.
Code: Select all
$sql = mysql_query("SELECT id, FROM Members WHERE email_activated='1' ORDER BY id ASC");
$nr = mysql_num_rows($sql);
Code: Select all
function nationality_list ( )
{
global $dbc;
$select = " SELECT
id
$from = " FROM
Members ";
$query = $select.$from ;
$result = mysqli_query ($dbc, $query);
$nr = mysql_num_rows($result);
return $result ;
}
1. is this the correct way to get the num rows
2. if so , how do i extract the number from the PHP function.
is it possible to do two returns from a function. i.e
Code: Select all
$result = mysqli_query ($dbc, $query);
$nr = mysql_num_rows($result);
return $result ;
return $nr ;
andreea