I am trying to save the binary of UUID as primary key in a table.
I am using the UNHEX(REPLACE(UUID(),"-",""))
to convert the UUID to binary after removing the dashes from it. This works perfect in SQL query executed directly on phpMyAdmin. But in a SLIM php prepared statement it gives me the following error:
Uncaught Error: Call to a member function bind_param() on boolean.
$stmt = $this->conn->prepare("INSERT INTO profile(profile_id, profile_firstname, profile_lastname) values (UNHEX(REPLACE(UUID(),'-','')),?,?)");
$stmt->bind_param("ss", $profile_firstname,$profile_lastname);
$stmt->execute();
Note that if i write any static value (i.e. '123'
) instead of UNHEX(REPLACE(UUID(),'-',''))
error is gone.