I am trying to insert UUID()
together with my INSERT
query.
$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();
This query return this error Cannot pass parameter 2 by reference ... on line 51. And it points to the line $stmt->bindParam(':uuid',"SELECT UUID()",PDO::PARAM_STR);
What am I doing wrong in here?