The following code shows an array of records in the $rows array from the MySQL query. I have added also an if statement to check if $rows turns up empty, but it is not working.
$rows = array();
$result1 = mysql_query("SELECT * FROM TestPhase where Pid<10", $db) or die("cannot select");
while($row = mysql_fetch_array($result1)) {
  $rows []= array(
    'id' => $row['id'],
    'parent' => $row['parent'],
    'name' => $row['name'],
  );
}
if($rows == ""){
    echo "No Data";
    }
This if statement is not working. How do I check if the array returns empty and echo "No Data". 
How would I check to see if the array is empty in javascript? I have placed the $rows array in a var treeData.
if (treeData) is empty{
$("button").hide();
     }
How do I check if treeData is empty to hide the button.
 
     
     
     
     
    