我试图将UUID()
与我的INSERT
查询一起插入。无法通过参考传递参数2 - uuid PDO
$handle->beginTransaction();
// Define query
$query = "INSERT INTO users (users_uuid, type_id) VALUES (:uuid, :type_id)";
// Prepare statement
$stmt = $handle->prepare($query);
// Bind parameters
$stmt->bindParam(':uuid',"SELECT UUID()",PDO::PARAM_STR);
$stmt->bindParam(':type_id',1,PDO::PARAM_INT);
// Execute query
$stmt->execute();
$handle->commit();
该查询返回该错误不能按引用传递参数2 ......上线51。它指向线$stmt->bindParam(':uuid',"SELECT UUID()",PDO::PARAM_STR);
我在这里做错了什么?
可能重复的[PHP错误:“无法通过引用传递参数2”](https://stackoverflow.com/questions/13105373/php-error-cannot-pass-parameter-2-通过引用) –