我的代碼是在這裏:如何將變量的值賦值給之前的另一個變量?
$array_letter = array("A","B","C","Ç","D","E","F","G","H","I","İ","J","K","L",
"M","N","O","P","R","S","Ş","T","U","Ü","V","Y","Z");
$sql = "SELECT id,city FROM city WHERE city LIKE '" .$array_letter[$i]."%'";
而且這些代碼之後:
for ($i=0;$i<27;$i++) {
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
echo "<h3>".$row['city']."</h3>";
}
}
$ sql中是沒有意義的,因爲$array_letter[$i]
將在那裏工作。但$ sql必須是這些設計代碼的頂部。因爲我編碼爲switch-case statement
。根據要求,$sql
將因此變化,因此我無法在for循環下編寫$sql
。但是,我所有的查詢取決於$array_letter
。我如何使$array_letter
工作?
你希望我們能爲你預測$ i嗎?-) – 2012-05-19 13:56:08
不,我不知道。雖然for循環工作,$ $如何可以在$ sql中分配?這就是我想要的。 – kalaba2003
酷信btw,是土耳其語嗎? :) –