John Davidson

Can't acces to values from array - PHP

0 comments
Message:


This is my code:


$arr = array();

$dns_1 = mysqli_query($conn, $query);
$dns_2 = mysqli_query($conn, $query);

$d1 = mysqli_fetch_assoc($dns_1);
$d2 = mysqli_fetch_assoc($dns_2);

$arr[1] = $d1;
$arr[2] = $d2;

foreach($arr as $key => $values) {
echo $key."".$values;
}

Output:


Notice: Array to string conversion in C:\xampp\htdocs\index.php on line 79
1Array

Why can't I echo the $values in my foreach??


I don't want to use implode if possible


Thank you!



My Answer:
I help you with something specific?

Rate this post

5 of 5 based on 9153 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us