我遇到的问题是当我回显或打印下列变量时,我收到的数据只是我表格中列出的最后一项业务的数据。查询为什么只返回一组数据?
目前无论上市我单击我得到的最后一次业务返回相同的一组数据。
正如您在下面的代码中所看到的,我将通过点击列表中的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