【发布时间】:2015-06-25 19:26:34
【问题描述】:
这里出了点问题。我在提交时收到错误:这需要是一个简单的下拉选项,您可以在其中选择 2 个提示...
您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在第 1 行的 ORDER BY int_displayorder ASC 附近使用正确的语法 SELECT var_price_label1,var_price_label2,var_price1,var_price2 FROM dis_activity where int_glcode= ORDER BY int_displayorder ASC
文件名:/home/discou60/public_html/beta/modules/reservationleads/models/reservationleads_model.php 行号:1337
$SQL = $this->db->query("SELECT var_price_label1,var_price_label2,var_price1,var_price2 FROM " . DB_PREFIX . "activity where int_glcode=$tagid ORDER BY int_displayorder ASC");
$RS = $SQL->Result();
$Html = "";
$Html .= "<select name='int_no_of_people' id='int_no_of_people' ><option value=''> Choose Your charter</option>";
foreach ($RS as $Row) {
$selected = "";
if (!empty($tagid) && $tagid == $Row->int_glcode) {
$selected = "selected='selected'";
}
$Html .= "<option $selected value='" . $Row->var_price1 . "'>" . $Row->var_price_label1 . "</option>";
$Html .= "<option value='" . $Row->var_price2 . "'>" . $Row->var_price_label2 . "</option>";
}
$Html .= "</select>";
return $Html;
【问题讨论】:
-
除了你显示的代码中没有
ORDER BY... -
where int_glcode= ORDER BY肯定有错误。它是在哪里/如何生成的,我不知道。所以这部分where int_glcode=缺少一些没有被填充的东西。 -
所以你的
$tagid变量是空的。在将其添加到查询之前,您应该检查它的值。 -
where int_glcode=$tagid是它失败的地方。$tagid没有被填充。可能需要引用;很难说。 -
@jeroen 应该将您的评论作为答案;-)
标签: php mysql codeigniter