this is my php code
<?php
$code='1,2,3';
$this->db->query("CALL SP_db(\"$code\"));
?>
if i var_dump($code) i get this string(5) "1,2,3"
and this my stored procedure code
CREATE DEFINER=`test`@`localhost` PROCEDURE `SP_db`(v_company varchar(10))
begin
select * from blabla where company_id in (v_company);
.
.
.
i use this code to insert some value into table
the problem if i use this code,where i get v_company from php its not working
but if i try to fill the value it works
CREATE DEFINER=`test`@`localhost` PROCEDURE `SP_db`(v_company varchar(10))
begin
select * from blabla where company_id in (1,2,3);
but the value being sent by php is received by stored procedures,
i try to save v_company value into table to make sure and it work
because the value from php entered into the table
so can someone tell where the code is wrong
When you pass ‘1,2,3’ to your procedure, you get a string, and your query becomes
not
You can use
find_in_setinsted ofinbut it will not use index so well, as
indoes;