![]() |
$this->db->where - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: $this->db->where (/showthread.php?tid=19257) |
$this->db->where - El Forum - 06-02-2009 [eluser]me_not_you[/eluser] Hi, I'm still getting started with CI...so sorry if my Q is dum... but i've got 2 functions Code: function getone($id){ with 2 models Code: <?php Code: WHERE IDtype = 3 AND IDmanifestation = 1 How can i get the $this->db->where back to nothing?? $this->db->where - El Forum - 06-02-2009 [eluser]TheFuzzy0ne[/eluser] I can see four problems with your getname method. 1) You should ditch the closing ?> PHP tag. It's not needed, and is not useful since it's the cause of a well known problem. 2) I'd strongly suggest adding underscores to your method name, and variables. 3) You are making your database query before setting the WHERE clause, which is why it's still there after you think you've made the first query. 4) You are not adding to the name array, you're only overwriting it with a string. Here's my proposed replacement function for getname: Code: public function get_names($id){ $this->db->where - El Forum - 06-02-2009 [eluser]me_not_you[/eluser] thanks, that help me... don't know why i left those php tags ;-) just another thing i'm getting "marchÃ@" instead of marché do you have any ideas?? $this->db->where - El Forum - 06-02-2009 [eluser]TheFuzzy0ne[/eluser] [url="http://validator.w3.org/"]Validate[/url] your HTML, and all will become clear. You'll no doubt need to set the page encoding, and add a doc type. $this->db->where - El Forum - 06-02-2009 [eluser]meigwilym[/eluser] Quote:just another thing i’m getting “marchÃ@” instead of marché Se ne marche pas? ;-) You need to set the encoding for the files, any DataBase tables you may have and what's sent to the browser. I save all files using UTF-8. Netbeans does this for me for every project now, but I used to do it in Notepad++ using the Format menu (encode in UTF-8). All your DB table should be in utf8_general_ci collation (the tables and fields). Finally, send a header before you output anything with Code: $this->output->set_header('Content-Type: text/html; charset=utf-8'); Code: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> Bon chance! Mei |