如何修复函数错误?
已弃用:必需参数 $orderfield 位于 C:\xampp\htdocs\shop\includes\functions\functions.php 第 8 行中的可选参数 $where 之后
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;
}
Run Code Online (Sandbox Code Playgroud)
<?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" …Run Code Online (Sandbox Code Playgroud)