Search the Community
Showing results for tags 'warning: mysqli_fetch_array()'.
-
Hello everyone! Nice forum, runs real smooth I'm receiving the following error message: Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given (this is on line 6) Warning: mysqli_fetch_row() expects parameter 1 to be mysqli_result, null given (this is on line 14) The error is related to the following code: $sql = "SELECT username, avatar FROM users WHERE avatar IS NOT NULL AND activated='1' ORDER BY RAND () LIMIT 32"; $query = mysqli_query($db_conx, $sql); $userlist = ""; while ($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) { (this is line 6) $u = $row["username"]; $avatar = $row["avatar"]; $profile_pic = 'user/'.$u.'/'.$avatar; $userlist .= '<a href="user.php?u='.$u.'" title="'.$u.'"><img src="'.$profile_pic.'" alt="'.$u.'" style="width: 100px; height: 100px; margin: 10px;"></a>'; } $sql = "SELECT COUNT (id) FROM users WHERE activated='1'"; $query = mysqli_query($db_conx, $sql); $row = mysqli_fetch_row ($query); (this is line 14) $usercount = $row [0]; I'm not sure what's causing it, I know it seems to be a problem with a parameter that's not working right, I looked over the code, couldnt find it. I'm wondering if it could be a database issue? but I don't think so. This is a script to show user avatar images in a area of the page. It tells the system to show random user profile pictures if they are registered, activated and have an avatar image. ANY help would be highly appreciated, been trying to solve this for a while now, the rest of the website and script works perfectly so far and there's ALOT of it