如何用PHP变量作为参数调用php中的mysql过程?

时间:2013-11-14 04:11:45

标签: php mysql function post stored-procedures

我已经定义了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)');
}

0 个答案:

没有答案