• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Help] why cant access NULL value

#1
[eluser]C_Line[/eluser]
i have a code like this
Code:
$id_sups = $this->db->query("Select id_supplier from supplier where
                            nama_supplier ='$finals[6]'")->result();
$id_supss = $this->db->query("Select id_supplier from supplier where
                             nama_supplier ='$finals[6]'");
if($id_supss->num_rows() < 0){
$jum = $this->db->query("select max(id_supplier) from supplier");
foreach($jum->result_array() as $cnt){
foreach($cnt as $key=>$value){
$nil = $value;
$id_supplier = $nil + 1;
}}
}else{
foreach($id_sups as $vals){
$id_supplier = $vals->id_supplier;
}}

but it can't access if dont have a row , if($id_supss->num_rows() < 0) <-- this code
but it can access when it have a row

help me, thx

#2
[eluser]guzzilar[/eluser]
if($id_supss->num_rows() < 1)
or
if($id_supss->num_rows() == 0)

try this Smile

#3
[eluser]C_Line[/eluser]
wow, that work !!
thx man Big Grin


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.