0
我已經將我的網站從一臺服務器移動到另一臺服務器,並且自從我從MySQL數據庫中獲取填充下拉列表的問題。PHP下拉行爲
<tr><td>IPad:</td>
<?
$sql="SELECT * FROM ipad_list order by asset asc";
$result=mysql_query($sql);
while (($row=mysql_fetch_array($result))
{
$id1=$row["asset"];
$options1.="<OPTION VALUE=\"$id1\">".$id1.'</option>';
}
?>
<td>
<SELECT NAME="asset">
<OPTION VALUE="0">Choose One</option>
<? echo $options1 ?>
</td></tr>
這是顯示的內容...
".$id1."; }
上面顯示不是我的填充下拉。
這適用於我現有的LAMP服務器,但不適用於我的新服務器。我相信PHP的安裝是相同的版本,所以爲什麼當我搬了這個不工作。
你沒有啓用短開放標籤,所以沒有被執行PHP代碼,和原始PHP代碼到達您的客戶端。改爲'<?php'。微不足道的確認:做一個你的頁面的「查看源代碼」。 –
請[停止使用'mysql_ *'函數](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php)。 [這些擴展](http://php.net/manual/en/migration70.removed-exts-sapis.php)已在PHP 7中刪除。瞭解[編寫](http://en.wikipedia.org/ wiki/Prepared_statement)語句[PDO](http://php.net/manual/en/pdo.prepared-statements.php)和[MySQLi](http://php.net/manual/en/mysqli.quickstart .prepared-statements.php)並考慮使用PDO,[這真的很簡單](http://jayblanchard.net/demystifying_php_pdo.html)。 –