skip to Main Content

I’m trying to use the mysql IN(,) function for flutter use, to retrieve two values from a single column

"SELECT * from TABLE WHERE COLUMN
IN (VAL1,VAL2) "<= Now this works fine in thunder client, I just want to implement it for flutter use, I tried:

"SELECT * from TABLE WHERE COLUMN
IN (?,?) " <= but I didn’t know how to assign it to the PHP variables.

please help

2

Answers


  1. If you just want to concat PHP variable to a string, try this:

    "SELECT * from TABLE WHERE COLUMN IN ('".$VAL1."','".$VAL2."') ";
    
    Login or Signup to reply.
  2. You can:

    $yourVars = "'111', '222', ";
            
    $q = "SELECT some_stuff FROM TABLE_NAME WHERE column IN (". $yourVars . ") ";
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search