• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
where() showing "IS NULL" instead of variable value

#1
Hello guys,

$email=''[email protected]';
$pass= 123;

$this->db->select('*')->from('user')->where(' email',$email)->where('password',$pass)-> get()->result();

this gives result :-

'select * from uses where email IS NULL and password IS NULL';

But it works with $this->db->query();

plz help me to find why its not taking like :-

'select * from user where email="[email protected]" and password="123" ';

Thanks,
Reply

#2
$emial=''[email protected]';
$pass= 123;

$this->db->select('*')->from('user')->where(' email',$email)->where('password',$pass)-> get()->result();

You are using different variable name insist of where condition.

Correct code:

$email=''[email protected]';
$pass= 123;

$this->db->select('*')->from('user')->where(' email',$email)->where('password',$pass)-> get()->result();
Reply

#3
(01-01-2018, 11:39 PM)XtreemDeveloper Wrote: $emial=''[email protected]';
$pass= 123;

$this->db->select('*')->from('user')->where(' email',$email)->where('password',$pass)-> get()->result();

You are using different variable name insist of where condition.

Correct code:

$email=''[email protected]';
$pass= 123;

$this->db->select('*')->from('user')->where(' email',$email)->where('password',$pass)-> get()->result();

sorry that was typing mistake. This is not the error i am facing. if i use "$this->db->select('*')->from('user')->where(' email',$email)->where('password',$pass)-> get()->result();" still it shows "select  * from users where email IS NULL and password IS NULL".
Reply

#4
Did you use this to see what is going on?

PHP Code:
$temp $this->db->last_query(); 

Also is there suppose to be a space after the opening quote before email?

PHP Code:
//                                           | space?
$this->db->select('*')->from('user')->where(' email',$email)->where('password',$pass)-> get()->result(); 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#5
(01-02-2018, 03:52 AM)InsiteFX Wrote: Did you use this to see what is going on?

PHP Code:
$temp $this->db->last_query(); 

Also is there suppose to be a space after the opening quote before email?

PHP Code:
//                                           | space?
$this->db->select('*')->from('user')->where(' email',$email)->where('password',$pass)-> get()->result(); 

returns 'select * from user where email IS NULL and password IS NULL';
Reply

#6
(01-01-2018, 11:34 PM)ktmonty Wrote: $email=''[email protected]';

That's 2 single quotes followed by an email address and another single quote. This would be a syntax error ...

I assume that's just a typing error on your part while posting here, but we can't help you debug if you don't give us the actual code as that means important details remain hidden. Please just copy-paste it.

Also, moving the thread to General Help as it has nothing to do with installation.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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