php - Prepared Statements in MYSQLi in combination with "SELECT WHERE IN" -


i'm facing little problem mysqli , prepared statements:

i want prepare , "in" statement in sqli not work me! :-(

can or explain me i'm doing wrong? think it's because of way prepared statements work , therefore magic (strip, addslashed ...) preventing solution maybe need else can figure out. sql statement:

$dbprepare = $db->prepare(     'select     `name`, `image`     `sometable`     `number` in (?)' ); $dbprepare->bind_param('s', $numbers); 

and way of achieving "$numbers":

$numbers = implode('","', explode(',', $_get['numbers'])); 

the "var_dump($numbers)" result this: string(5) "a","b" ($_get['numbers'] it's value this: &numbers=a,b)

i know, maybe not best solution, wanna transfer (in end $_post) data "in" statement including prepared variable.

for reference: working:

$dbprepare = $db->prepare(     'select     `name`, `image`     `sometable`     `number` in ("'.implode('","', explode(',', $_get['numbers'])).'")' ); 

so i'm quite sure it's because of prepared variable.

thanks in advance!

try  $dbprepare = $db->prepare(     'select     `name`, `image`     `sometable`     `number` in (?)' ); $dbprepare->bind_param('s', $numbers[0],$numbers[1]); 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -