Click here to Skip to main content
15,880,427 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I'm trying to select multiple value, right now it only get 1 value based on ImageID,
how can I make it return multiple value? I tried adding my $Value2 but it doesnt work.

SQL
$Value1 = 1;
$Value2 = 2;
$this->db->select("Link,Title");
             $this->db->from("imagelink_table");
             $this->db->where("ImageID = '$Value1'");
             //$this->db->where("ImageID = '$Value2'");
             $query = $this->db->get();




Thanks in advance.
Posted
Updated 14-Apr-14 16:41pm
v3

1 solution

What you are showing is not SQL it is some other query language extension for running SQL, try :
SQL
$this->db->where("ImageID = '$Value1' or ImageID = '$Value2'");
 
Share this answer
 
v2
Comments
Graham Breach 15-Apr-14 2:57am    
I think you meant "or" instead of "and"...
Mehdi Gholam 15-Apr-14 3:09am    
Right! thanks Graham!
KatsuneShinsengumi 22-Apr-14 8:59am    
Sorry for the late reply, I skipped this thing for a more urgent stuff. Thanks, it worked. And yes, this is not just sql it's an sql query for codeigniter.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900