Basically what I want to do is to use MySqli to just do a query UUID_SHORT()
and get the result. No INSERT
,UPDATE
,DELETE
or anything, I just want the value of UUID_SHORT
.
Haven't been able to figure it out, any help would be great!
Thanks.
How about SELECT UUID_SHORT();
There is more information in the MySQL documentation.
Example:
function UUID_SHORT(mysqli $db)
{
$result = $db->query("SELECT UUID_SHORT();");
$res = $result->fetch_array();
return $res[0];
}
You can expand function created by @competent_tech to add more flexibility:
Example:
function getUuid(mysqli $db, $short=false)
{
$query = "SELECT " . ($short ? "UUID_SHORT()" : "UUID()");
$result = $db->query($query)->fetch_array();
return $result[0];
}