if I have a query that looks like this in php...
if ($result3 = $connuser->query("SELECT * FROM devices WHERE uid='".$username."'")){
}
How can I turn $result3 into an array?
Also, separate question, I tried doing
echo $result3;
but it doesn't work. Is there a way to view $result3 so I can see what it looks like?
My Answer:
>query("SELECT * FROM users")) {
$users = array();
while ($row = $result3->fetch_assoc()) {
$users[] = $row;
}
}
This code will execute the query and store the results in an array called $users. Each row from the query result will be added as an element in the array.
Rate this post
4 of 5 based on 7883 votesComments