php - How to return null rows from mysql_num_rows? -


i have following mysql query returns data in json. what's best way check if there 0 records, , return fact?

$row_num = mysql_num_rows($rslt); $data = array(); while ( $row = mysql_fetch_row($result) ) {     $data[] = $row;      }    echo json_encode( $data ); 

$row_num = mysql_num_rows($rslt); $data = array(); while ( $row = mysql_fetch_row($result) ) {     $data[] = $row;      }    if(!$data){    echo "this government. have removed database!"; } else {     echo json_encode( $data ); } 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -