【发布时间】:2021-05-19 20:54:58
【问题描述】:
我有一个 MySQL 数据库,我在其中设置了一个存储过程,我知道存储过程有效,因为我可以从 phpMyAdmin 控制面板执行它。
我现在正尝试从我的网站执行该过程,我没有收到任何错误,但没有任何内容插入到我期望的各种表中。这是我从我的 php 页面运行的代码。
$link = new mysqli($host_name, $user_name, $password, $database);
if ($link->connect_error)
{
die('<p>Failed to connect to MySQL: '. $link->connect_error .'</p>');
}
else
{
$sp = $link->prepare("CALL sp_InsertNewSchematic(?, ?, ?, ?, ?, ?, ?)");
$sp->bind_Param('ssissss', $imageFilename, $schematicFileName, $Creator, $youtube, $description, $tags, $versions);
$sp->execute();
}
【问题讨论】:
-
execute()的返回值是多少?有什么错误吗?每次调用prepare()或execute()后,您总是需要检查错误。或者,enable mysqli exceptions. -
谢谢,没有意识到我需要专门输出错误,我调整了我的代码,发现我忘记了我的存储过程中的输出参数。