Welcome Guest, Not a member yet? Register   Sign In
where() showing "IS NULL" instead of variable value
#1

(This post was last modified: 01-02-2018, 04:09 AM by ktmonty.)

Hello guys,

$email=''abc@abc.com';
$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="abc@abc.com" and password="123" ';

Thanks,
Reply
#2

$emial=''abc@abc.com';
$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=''abc@abc.com';
$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=''abc@abc.com';
$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=''abc@abc.com';
$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

(This post was last modified: 01-02-2018, 04:08 AM by ktmonty.)

(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=''abc@abc.com';

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




Theme © iAndrew 2016 - Forum software by © MyBB