I need to know how to make prepared statement read entire string instead of only 1st symbol. I have a prepared mysqli statement. I load 3 different strings which i create by converting arrays by implode function.
Example:
$animalstr = implode(',',$animal);
Same for others.
Every should be okay, because I specifically convert them to a format which is good for SQL.
But during testing, I found out that if I have more that 1 item of string (x1, x2, xn), all the rest except x1 is being ignored.
elseif ($flag["mat"]&&$flag["animal"]&&$flag["org"]){
$stmt = $conn->prepare("select type, spice,breed,amount from unit where type_id in (?) and spice_id in (?) and col_id in (select id from collection where org_id in (?))");
$stmt->bind_param("sss",$matstr,$animalstr,$orgstr);
}
I have done some test in MySQL. And found out that if do this request
select type, spice, breed, amount
from unit
where type_id in (3, 6)
and spice_id in (1, 2)
and col_id in (select id from collection
where org_id in (1,2));
Then I get 85 rows, while doing the same in code results in 13 rows. same 3,6 1,2 1,2 request
To prove I've requested data from MySQL using only 1st symbol of each string
select type, spice, breed, amount
from unit
where type_id in (3)
and spice_id in (1)
and col_id in (select id from collection where org_id in (1));
So this completely prove my theory about statement reading each of my strings' only first letter, ignoring rest.