How to fix the function error?
Deprecated: Required parameter $orderfield follows optional parameter $where in C:\xampp\htdocs\shop\includes\functions\functions.php on line 8
function getAllFrom($field, $table, $where = NULL, $and = NULL, $orderfield, $ordering = "DESC") {
global $con;
$getAll = $con->prepare("SELECT $field FROM $table $where $and ORDER BY $orderfield $ordering");
$getAll->execute();
$all = $getAll->fetchAll();
return $all;
}
<?php
$allItems = getAllFrom('*', 'items', 'where Approve = 1', '', 'Item_ID');
foreach ($allItems as $item) {
echo '<div class="col-sm-6 col-md-3">';
echo '<div class="thumbnail item-box">';
echo '<span class="price-tag">$' . $item['Price'] . '</span>';
echo '<img class="img-responsive" src="img.png" alt="" />';
echo '<div class="caption">';
echo '<h3><a href="items.php?itemid='. $item['Item_ID'] .'">' . $item['Name'] .'</a></h3>';
echo '<p>' . $item['Description'] . '</p>';
echo '<div class="date">' . $item['Add_Date'] . '</div>';
echo '</div>';
echo '</div>';
echo '</div>';
}
?>