0

我有一个选择框,可以选择“非常低”、“低”、“中”、“高”和“非常高”,可以在 0-19、20-39 等到 100 之间进行选择。

模型:

if  ($this->input->post('interest_rating') != "")  
{
    $range = explode($this->input->post(' ','interest_rating'));
    $this->db->where('webinar_event.interest_rating >= ', $range[0]);
    $this->db->where('webinar_event.interest_rating <= ', $range[1]);
}

我得到 2 个单独的错误
1)

A PHP Error was encountered

Severity: Warning

Message: Wrong parameter count for explode()

Filename: models/hp_model.php

Line Number: 128

A Database Error Occurred

Error Number: 1064  

2)

您的 SQL 语法有错误;查看与您的 MySQL 服务器版本相对应的手册,了解在'ANDwebinar_event .interest_rating附近使用的正确语法<=' at line 5

SELECT * FROM (`health_professional`) JOIN `webinar_event` ON `webinar_event`.`hpid` = `health_professional`.`hpid` WHERE `webinar_event`.`interest_rating` >= AND `webinar_event`.`interest_rating` <=

文件名:D:\Development\PfizerWebinar\web\system\database\DB_driver.php

行号:330

任何帮助将不胜感激,谢谢

4

1 回答 1

2

错误编号 1

您必须为explode()函数提供 2 个参数,第一个必须是 delemeter,第二个必须是字符串 Like explode(delemeter,string)

所以你的爆炸必须是 $range = explode(' ', $this->input->post('interest_rating')); 错误号 2

SELECT * FROM (`health_professional`) JOIN `webinar_event` ON `webinar_event`.`hpid` = `health_professional`.`hpid` WHERE `webinar_event`.`interest_rating` >= 'somevalue' AND `webinar_event`.`interest_rating` <= 'somevalue'

您在查询条件中没有关联的值

于 2013-05-09T15:53:04.090 回答