I am getting this error "Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, array given in" out of code snippet "searchcar.php"
$modelmake = $_POST['model_make'];
$result = $db->select('car_information','*', 'Model_Make LIKE \'%$modelmake%\'');
while($row = mysqli_fetch_assoc($result))
{
echo 'Model'.$row['model_make'];
}
here is code snippet from "database.php" the select function
public function select(
$table,
$fields = '*',
$where = '1=1',
$order = '',
$limit = '',
$desc = false,
$limitBegin = 0,
$groupby = null,
$monitoring = false
) //monitoring is set to true to view the actual query
{
// $query ='SELECT ' . $fields . ' FROM ' . $table ;
$query = 'SELECT ' . $fields . ' FROM ' . $table . ' WHERE ' . $where;
if (!empty($groupby)) {
$query .= ' GROUP BY ' . $groupby;
}
if (!empty($order))
{
$query .= ' ORDER BY ' . $order;
if ($desc)
{
$query .= ' DESC';
}
}
if (!empty($limit))
{
$query .= ' LIMIT ' . $limitBegin . ', ' . $limit;
}
$result = $this->_sendQuery($query);
$resultArray = array();
while ($row = mysqli_fetch_assoc($result))
{
$resultArray[] = $row;
}
if ($monitoring)
{
// If monitoring is activated, echo the query
echo $query;
}
return $resultArray;
}
I want to use this line "while($row = mysqli_fetch_assoc($result))" Please advice!