For the past two days or so I\'ve been converting my functions to mysqli. I\'ve run into a problem. I have a function that returns an array containing a row from the databas
You have to use a loop to get them all at once:
fetch_assoc()) {
$rows[] = $row;
}
return $rows;
}
// Usage
$query = 'SELECT DISTINCT $fields FROM `posts` WHERE `profile_user_id` = $user_id LIMIT 4';
$result = $mysqli->query($query);
$rows = resultToArray($result);
var_dump($rows); // Array of rows
$result->free();