首先我會說我爲我的標題道歉。我真的不知道mysql表的正確名稱是什麼。所以我有一個如下所示的mysql表。基於其他列名稱的回聲mysql列與php
'id' | 'username' | 'password' | 'product' | 'price'
'1' | 'ben' | 'hashedpw' | 'desktop' | '120'
'2' | 'steve' | 'hashedpw' | 'laptop' | '300'
比方說我的數據庫名爲硬件和我的數據庫用戶稱爲所有者密碼被稱爲密碼和表稱爲高科技
我怎麼會是能夠使用PHP來回應產品價格。
$sql = "select * from users";
$query = mysql_query($sql);
$row['prodyct'];
我搞不清楚的是如何讓結果只顯示桌面的價格。我不能使用ID,因爲某些ID會在不同的時間丟失。
[請不要在新代碼中使用'mysql_ *'函數](http://stackoverflow.com/q/12859942/1190388)。他們不再被維護,並[正式棄用](https://wiki.php.net/rfc/mysql_deprecation)。看到紅色框?改爲了解準備好的語句,然後使用[tag:PDO]或[tag:MySQLi]。 – hjpotter92