-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>';
}
?>
select * from pessoas where id
. What id ?– Pedro Augusto
Do so, return query errors:
$rs = mysqli_query($conn,$query) or die(mysqli_error($conn));
– Pedro Augusto
select * from people Where id referesr table id people --:id --:name --:phone
– Carlos Coelho
But does it make a mistake? If so, what mistake? And in which line?
– Pedro Gaspar
Not from the online error but the whole page is blank as if it had not been loading anything or pulling anything.. errors do not return
– Carlos Coelho
Would not be
$query = "select user_role from tbl_user_role where id = '$id'";
? Another thing already commented iswhere id
I believe it should be$query = "select * from pessoas"
; to bring all the lines.– user60252
Fatal error: Uncaught Error: Call to Undefined Function mysql_fetch_assoc() in /var/www/server/
– Carlos Coelho
The functions
mysql_*
are obsolete and have been removed in PHP 7, what you probably want ismysqli_fetch_assoc
with thei
– Costamilam
Thank you the error was right here mysqli_fetch_assoc
– Carlos Coelho