COALESCE toegevoegd + lege databaseregel verwijderd

This commit is contained in:
Monique
2022-12-09 17:34:01 +01:00
parent 0a9bf59d51
commit 2bbfa82e46
@@ -22,15 +22,9 @@ class Schooldetails_model extends MY_Model{
}
function get_details2($schoolid){
$this->sql="SELECT id, organisatie_id,
if (straat AND straat is not null, straat, '' ) as straat,
if (plaats AND plaats is not null, plaats, '') as plaats,
if (telefoon AND telefoon is not null, telefoon,'') as telefoon,
if (email1 AND email1 is not null, email1, '') as email1,
if (web AND web is not null, web , '') as web,
if (directie AND directie is not null, directie ,'') as directie,
if (ib AND ib is not null, ib, '') as ib,
if (email2 AND email2 is not null, email2, '') as email2
$this->sql="SELECT id, organisatie_id, COALESCE(straat, '') AS straat, COALESCE(plaats, '') AS plaats,
COALESCE(telefoon, '') AS telefoon, COALESCE(email1, '') AS email1, COALESCE(web, '') AS web,
COALESCE(directie, '') AS directie, COALESCE(ib, '') AS ib, COALESCE(email2, '') AS email2
FROM tb_schooldetails
WHERE organisatie_id={$schoolid}";
return $this->get_query_row();