好的,我在这里,直截了当,我需要一些建议
所以在这里我有一些“数据库”的代码点火器问题,这是代码
$as="&";
$string1="title=";
$a= $this->input->post('title');
$string2="category=";
$b= $this->input->post('category');
$string3="length_comparison=";
$c= $this->input->post('length_comparison');
$string4="length=";
$d= $this->input->post('length');
$combine=$string1.$a.$as.$string2.$b.$as.$string3.$c.$as.$string4.$d;
$this->db->select('*');
$this->db->from('ci_query');
$this->db->where('ci_query.query_string',$combine);
$query = $this->db->get();
$rows=$query->result();
$count=0;
foreach($rows as $row)
{
$count=$count+1;
$query_id = $row->id;
}
if($count==0)
{
$query_id = $this->input->save_query($query_array);
}
redirect("films/display/$query_id");
这是逻辑
1. i got an input from a search form tittle,category,length_comparison,and length.
2. first case these logic will save all those input into a column in a table, all in 1 column, if there is no same parameter
"tittle,category,length_comparison,and length" in the table.
3. but if there is any same parameter it will not insert to the table, and just redirect to the page i choose
4. from the table we got the id and display instead of using long query string. display the search result.
我的问题:我已经完成了编码,它在我的电脑/PC 上运行良好。但是当我使用我的笔记本电脑时它就是无法工作,任何人都可以给我一些建议吗?还是我的编码?还是ci版本?或者是什么?
更新 :
我认为这不是问题,因为我已经覆盖了库,所以我有这个来使用那个函数
function save_query($query_array) {
$CI =& get_instance();
$CI->db->insert('search', array('query_string' => http_build_query($query_array)));
return $CI->db->insert_id();
}
function load_query($query_id) {
$CI =& get_instance();
$rows = $CI->db->get_where('search', array('id' => $query_id))->result();
if (isset($rows[0])) {
parse_str($rows[0]->query_string, $_GET);
}
}
}