Note that there are some explanatory texts on larger screens.

plurals
  1. POCodeIgniter Sql syntax not working
    text
    copied!<p>Okay here i am, be direct i need some advice</p> <p>so here i have some code igniter problem with "Database", this is the code</p> <pre><code> $as="&amp;amp;"; $string1="title="; $a= $this-&gt;input-&gt;post('title'); $string2="category="; $b= $this-&gt;input-&gt;post('category'); $string3="length_comparison="; $c= $this-&gt;input-&gt;post('length_comparison'); $string4="length="; $d= $this-&gt;input-&gt;post('length'); $combine=$string1.$a.$as.$string2.$b.$as.$string3.$c.$as.$string4.$d; $this-&gt;db-&gt;select('*'); $this-&gt;db-&gt;from('ci_query'); $this-&gt;db-&gt;where('ci_query.query_string',$combine); $query = $this-&gt;db-&gt;get(); $rows=$query-&gt;result(); $count=0; foreach($rows as $row) { $count=$count+1; $query_id = $row-&gt;id; } if($count==0) { $query_id = $this-&gt;input-&gt;save_query($query_array); } redirect("films/display/$query_id"); </code></pre> <p>Here is the logic</p> <pre><code> 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. </code></pre> <p>My problem : i've done the coding and it's work perfectly in my computer/pc. but when i use my laptop it's just doesn't work, anyone can give me some advice ? or my coding? or ci version? or what?</p> <p>Update : </p> <p>i think that is not the problem since i've override the lib, so i have this to use that function </p> <p> <pre><code>function save_query($query_array) { $CI =&amp; get_instance(); $CI-&gt;db-&gt;insert('search', array('query_string' =&gt; http_build_query($query_array))); return $CI-&gt;db-&gt;insert_id(); } function load_query($query_id) { $CI =&amp; get_instance(); $rows = $CI-&gt;db-&gt;get_where('search', array('id' =&gt; $query_id))-&gt;result(); if (isset($rows[0])) { parse_str($rows[0]-&gt;query_string, $_GET); } } </code></pre> <p>}</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload