This question already has an answer here:
- mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row()/mysql_num_rows etc… expects parameter 1 to be resource or result 31 answers
I've looked over all the other questions pertaining to this 'warning' but none are the same as my issue. My issue seems to be quit simple though i just can't seem to figure it out. I've tried every solution i've seen on google and here but i'm not familiar enough with php/mysqli to resolve it. Thanks in advance!
<?php
$db = new mysqli('localhost', 'root', '', 'game');
if($db->connect_errno > 0){
die('Unable to connect [' . $db->connect_errno . ']');
}
$query = mysqli_query($db, "SELECT * FROM `characters`");
$query_result = array();
while ($row = mysqli_fetch_assoc($query)) {
$query_result[$row['id']] = array(
'name' => $row['name'],
'name' => $row['race'],
'name' => $row['level']
);
}
?>