I am trying to insert UUID() along with my INSERT request.
$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 request returns 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 here?
source share