我遇到的問題是當我回顯或打印下列變量時,我收到的數據只是我表格中列出的最後一項業務的數據。查詢爲什麼只返回一組數據?
目前無論上市我單擊我得到的最後一次業務返回相同的一組數據。
正如您在下面的代碼中所看到的,我將通過點擊列表中的business_name傳遞給我的查詢以查找相關業務配置文件信息。
$business_name = mysql_real_escape_string($_GET['business_name']);
$query = "SELECT
business_id,
category,
years_recommended,
profile_size,
business_name,
established,
employees,
service,
strengths,
ideal_for,
reassurance
FROM
business_data
WHERE
business_name = '$business_name'
AND
profile_size = 'A'
OR
profile_size = 'B'
OR
profile_size = 'C'
OR
profile_size = 'D'
OR
profile_size = 'E'";
$result = mysql_query($query, $dbc)
or die (mysql_error($dbc));
while($row = mysql_fetch_array($result)) {
$business_id = $row["business_id"];
$profile_size = $row["profile_size"];
$category = $row["category"];
$years = $row["years_recommended"];
$established = $row["established"];
$employees = $row["employees"];
$service = $row["service"];
$strengths = $row["strengths"];
$ideal_for = $row["ideal_for"];
$reassurance = $row["reassurance"];
}
echo...
如果您需要更多信息,請讓我知道。
我的代碼有什麼問題嗎?
非常感謝提前。
降票有點苛刻。它不像我已經付出了努力。 – 2012-01-27 15:51:43