嘿傢伙,我想重複這個聲明13次通過改變這個語句在一個循環或什麼。 "WHERE spending.SectorID = 1,2,3,4,5,6,7,8,9,10,11,12,13"
我怎樣才能成功地做到這一點,而無需再次輸入此代碼12次。我會單獨顯示數據雖然〜喜歡where sectorid = 1;
屬於一個表有一個按鈕來啓動該特定查詢PHP Multiarray LOOP WHERE CLAUSE
<?php
$spendingname= array();
$spendingpercent = array();
$spendingid = array();
mysql_select_db($database_conn2, $conn2);
$query_Spending = "SELECT CONCAT(spending.SectorID, spending.ExpenditureID) AS 'SpendingID',
expenditure.ExpenditureName, spending.SpendingPercent, spending.SectorID
FROM spending
INNER JOIN expenditure ON spending.ExpenditureID = expenditure.ExpenditureID
WHERE spending.SectorID = 1";
$Spending = mysql_query($query_Spending, $conn2) or die(mysql_error());
$totalRows_Spending = mysql_num_rows($Spending);
while($row_Spending = mysql_fetch_assoc($Spending))
{
$spendingname[] = $row_Spending['ExpenditureName'];
$spendingpercent[] = $row_Spending['SpendingPercent'];
$spendingid[]= $row_Spending['SpendingID'];
}
mysql_free_result($Spending);
?>
但傢伙們將如何識別它?我必須$ {'消費'。$ i} = array(); – 2012-01-04 18:08:15