Welcome Guest, Not a member yet? Register   Sign In
Only showing records that have a value in a SQL table field
#1

[eluser]internut[/eluser]
Hey all...

I have a table that has:

[subscription_id] & [transaction_id]

I can do a call no problem to pull all records. I'm trying to do a link which calls a query which will only show a result if the [transaction_id] is set.

Thought maybe something like:

Code:
$this->db->where('transaction_id',TRUE);

could do the trick but no go... Suggestions?
#2

[eluser]rogierb[/eluser]
Maybe you can use !==NULL?
#3

[eluser]internut[/eluser]
Tried some things with a variation of null and not null... I have been thinking on this for a while. Finally trying to figure it out. Thought this would be simple. haha. I'm sure it is.

Just want to know / display if a value is set.
#4

[eluser]internut[/eluser]
looks like nerd boy got it:

Code:
$this->db->where("transaction_id > 1");

this the best way to go about it?

edit...

make that:

Code:
$this->db->where("transaction_id >= 1");
#5

[eluser]TheFuzzy0ne[/eluser]
Well, what's the default? Assuming the default is 0, then your where clause would be $this->db->where('transaction_id !=', 0);




Theme © iAndrew 2016 - Forum software by © MyBB