Prepared statements work fine in general. Having a bit 'o difficulty with the syntax for using a variable in the IN portion of a WHERE clause. Works great with a single value, but not more than one.. i.e.
query ok, 1 row affected
rows matched: 1
--cool...
If I change the SET statement to:
query OK, 0 rows affected
rows matched: 1
so, mysql "sees" just the first value in the list, but for some reason is unable to affect any rows..
Just point me to the reading material is there's someone who has already covered this succinctly..
Much thanks!
Code:
SET @list = "2";
PREPARE my_stmt FROM 'SELECT * FROM <table> WHERE my_id in (?)'
EXECUTE my_stmt Using @list;
query ok, 1 row affected
rows matched: 1
--cool...
If I change the SET statement to:
Code:
SET @list = "2, 3";
EXECUTE my_stmt Using @list;
query OK, 0 rows affected
rows matched: 1
so, mysql "sees" just the first value in the list, but for some reason is unable to affect any rows..
Just point me to the reading material is there's someone who has already covered this succinctly..
Much thanks!