Problem retrieving database records where a specific text field is empty |
[eluser]caperquy[/eluser]
Hello I have a database from which I want to extract the people for whom nothing has been entered in a field named "deces". If I run the following request directly within MySQL : Code: SELECT * FROM `personnes` WHERE `branche` = 'M' and `deces` = "" On the other hand if I run the same request within my Codeigniter application Code: $this->db->select('*'); Is there another way to build such request within Codeigniter ? Many thanks for help. Caperquy
[eluser]PhilTem[/eluser]
http://forums.digitalpoint.com/showthread.php?t=29204 Code: SELECT * FROM table_name WHERE !(ISNULL([columnname])); OR Code: SELECT * FROM table_name WHERE LENGTH(columnname) = 0 (though I haven't tried the second suggestion).
[eluser]CroNiX[/eluser]
You might try manually setting the whole where statement on that line instead of using the 2nd parameter for the value Code: $this->db->where('deces = ""'); //two double quotes followed by a single quote
[eluser]caperquy[/eluser]
Many thanks for help. I tried what you said and this time it works. Regards Caperquy |
Welcome Guest, Not a member yet? Register Sign In |