• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[HELP] can't retrive a value

#1
[eluser]C_Line[/eluser]
Code:
Controller
if($this->Query_barang->cek_supplier($value) == "FALSE" or $this->Query_barang->cek_supplier($value) == NULL)
{
echo "[removed]";
echo "alert('Tidak ada supplier lain yang tersedia')";
echo "[removed]";
}

Model
function cek_supplier($value)
{
$amb_idbrg = $this->db->query("Select * from barang where nama_barang = '$value'")->result();
foreach($amb_idbrg as $isi)
{
$id_brg = $isi->id_barang;
}


$amb_idsup = $this->db->query("Select id_supplier from barang_supplier where id_barang = '$id_brg'");
if($amb_idsup->num_rows < 1 or $amb_idsup->num_rows == 0 or $amb_idsup->num_rows < 0)
{
return FALSE;
}else{
return TRUE;
}
}

why it can't return False if the row is NULL or < 1 || < 0
thx


Messages In This Thread
[HELP] can't retrive a value - by El Forum - 07-12-2012, 08:30 PM
[HELP] can't retrive a value - by El Forum - 07-12-2012, 09:40 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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