Where is the error? I can not pull table from the database!

-1
 function getUserAccessRoleByID($id)
{
    global $conn;

    $query = "select user_role from tbl_user_role where  id = ".$id;

    $rs = mysqli_query($conn,$query);
    $row = mysqli_fetch_assoc($rs);

    return $row['user_role'];
}



function get_Pessoas()
{
    global $conn;

    $query = "select * from pessoas where id "; //query the db

    $rs = mysqli_query($conn,$query);
    $resArr = array(); //create the result array

    while($row = mysql_fetch_assoc($rs)) { //loop the rows returned from db
    $resArr[] = $row; //add row to array
}
echo '<pre>'; print_r($resArr); echo '</pre>';
return $resArr;   
}

  aqui puxo os resultados 

   <?php 

     $pessoas = get_Pessoas(); //get the result array

                    foreach($pessoas as $cond) { //loop the array
                        echo '<h1>'. $cond['cd_name']. '</h1>';
                        echo '<p>'. $cond['cd_idade']. '</p>';
                    }

                     ?>
    
asked by anonymous 20.10.2018 / 22:22

1 answer

0

While ($ row = mysqli_fetch_assoc ($ rs)) the error was right here!

    
21.10.2018 / 18:44