PHP存储过程无法正常工作

时间:2017-12-17 15:04:22

标签: php stored-procedures

我有大约10个存储过程,它们都工作正常但是当我用php调用这个特定的一个时,插入数据库不起作用。当我在phpmyadmin中执行它时它确实有效,所以问题出在php。

PHP文件

<?php

 include 'test.php';

 session_start();

 if(isset($_POST['submit'])){
    $recipeTitle = $_POST['title'];
    $recipeDescription = $_POST['description'];
    $recipePic = $_POST['picture'];
    $categoryId = $_POST['catId'];
    $subCatId = $_POST['subId'];
    $prepTime = $_POST['prepTime'];
    $cookingTime = $_POST['cookTime'];
    $cookingTemperature = $_POST['temp'];
    $degrees = $_POST['degrees'];

    $conn->query("CALL RB_AddNewRecipe('$recipeTitle', '$recipeDescription', 
    '$recipePic', $categoryId, $subCatId, $prepTime, 
                $cookingTime, $cookingTemperature, '$degrees')");

    header('Location: ../allRecipes.php');
    end;

     }

    ?>

程序

BEGIN

INSERT INTO RECIPE
(title, description, image, category_id, sub_category_id, preparation_time,  
cooking_time, temperature, degrees)
VALUES(p_title, p_description, p_image, p_category_id, p_sub_category_id, 
p_preparation_time, p_cooking_time, p_temperature, p_degrees);

SELECT LAST_INSERT_ID() AS recipe_id;

END

0 个答案:

没有答案