0
我想從MySQL中提取數據,這應該顯示完整的數據,但這隻顯示一行。這應該顯示所有用戶行。我不知道我做錯了什麼:在這個PHP函數中沒有像預期的那樣工作
下面是代碼:
function getCashoutRequests($uid, $limit) {
if (!empty($limit)) {
$query = mysql_query('' . 'SELECT * FROM cashouts WHERE uid = ' . $uid . ' ORDER BY id DESC LIMIT ' . $limit);
}
else {
$query = mysql_query('' . 'SELECT * FROM cashouts WHERE uid = ' . $uid . ' ORDER BY id DESC');
}
if (mysql_num_rows($query)) {
if ($row = mysql_fetch_object($query)) {
$row->id;
$amount = $row->amount;
$status = $row->status;
$client_notes = nl2br($row->user_notes);
$admin_notes = nl2br($row->admin_notes);
$request_date = $row->request_date;
$payment_date = $row->payment_date;
$fee = $row->fee;
$priority = $hid = $row->priority;
$method = $row->method;
if ($payment_date != '0000-00-00 00:00:00') {
$payment_date = date('d M, Y', strtotime($payment_date));
}
$request_date = date('d M, Y', strtotime($request_date));
$payHistory []= array('id' => $hid, 'cash' => $amount, 'status' => $status, 'method' => $method, 'client_notes' => $client_notes, 'admin_notes' => $admin_notes, 'date' => $request_date, 'payment_date' => $payment_date, 'fee' => $fee, 'priority' => $priority);
}
return $payHistory;
}
return false;
}