Parameter error with Mysqli
        Posted  
        
            by 
                Morgan Green
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Morgan Green
        
        
        
        Published on 2012-10-23T04:58:22Z
        Indexed on 
            2012/10/23
            5:00 UTC
        
        
        Read the original article
        Hit count: 203
        
When I run this Query I recieve
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in /home/morgan58/public_html/wow/includes/index/index_admin.php on line 188
SELECT * FROM characters WHERE id=5
Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in /home/morgan58/public_html/wow/includes/index/index_admin.php on line 194
The Query is running and it is strying to select the correct information, but for on the actual output it's giving me a fetch_array error; if anyone can see where the error lies it'd be much appreciated. Thank you.
<?php
  $adminid= $admin->get_id();
  $characterdb= 'characters';
$link = mysqli_connect("$server", "$user", "$pass", "$characterdb");
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}
$query = "SELECT * FROM characters WHERE id=$adminid";
$result = mysqli_query($link, $query);
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC))
{
echo $query;
echo $row['name'];
}
mysqli_free_result($result);
mysqli_close($link);
?>
© Stack Overflow or respective owner