我已经定义了mysql过程如下
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `create_subcategories`(IN path VARCHAR(255))
BEGIN
insert ignore into moodleui.z_subcategories(name, idnumber, description, status, last_processed_date)
select distinct concat(path, subject), subject, subject, 0, now() from moodleui.timetable_instructor;
-- where concat(path, subject) not in (select name from moodleui.z_subcategories);
END
现在我想用 php 调用这个过程。我也想传递一个 php 变量作为参数而不是常量字符串。我尝试了以下方法,但似乎不起作用。请帮我解决一下这个。
if(isset($_POST['path']))
{
$path=$_POST['path'];
echo $path;
mysql_query('CALL create_subcategories($path)');
}