php - 由于缺少值,函数内的存储过程失败
问题描述
我无法弄清楚我的错误出在哪里,但我正在调用此函数并发送 3 个必需的参数,但该过程在执行时失败。
我添加了一个 dump and die 语句,它打印了程序中使用的所有 4 个参数。我关心的一件事是确保所有 4 件事都作为字符串正确发送,因为它们都应该是过程中的字符串。
也许是别的原因,因为当我将 4 个参数值手动添加到我的 IDE 中时,它们成功地输入了数据库。我如何发送这些值有问题吗?
function createUser($out2,$email,$access){
$type = 'web';
$userStmt = \DB::connection('odbc')->getPdo()->prepare("call schema.insertUser(?,?,?,?)");
$userStmt->bindParam(1, $out2, PDO::PARAM_STR,20);
$userStmt->bindParam(2, $email, PDO::PARAM_STR,140);
$userStmt->bindParam(3, $access, PDO::PARAM_STR, 2500);
$userStmt->bindParam(4, $type, PDO::PARAM_STR, 20);
dd("Out" . $out2 . "Email" . $email . "Access" . $access . "Type" . $type);
$userStmt->execute();
}
转储 $userStmt
PDOStatement {#845 ▼
+queryString: "call schema.insertuser(?,?,?,?)"
errorInfo: array:4 [▼
0 => ""
1 => 0
2 => " ((null)[0] at (null):0)"
3 => ""
]
}
解决方案
推荐阅读
- pine-script - 如何打破这个限制?
- c# - 存储大量标签的好方法是什么?
- c - 使用 mmap() 为 2D 数组初始化共享内存,是否还需要为后续指针映射内存?我应该改用 shm 吗?
- sql - SQLite 中的 Group By 子句
- python - 当 CPython 设置`in` 运算符为 O(n) 时?
- angular - RXJS 在 Websocket 断开连接后重新连接侦听器
- c - 有没有一种快速的方法来删除 glibc 中的 malloc/free/memalign/realloc 钩子?
- python - Pandas 通过两列中的值连接数据帧
- javascript - 使用 for 循环打印
- html - 我将如何根据在什么设备上查看网站来更改网站?