you do not need to use errno. Checking mysqli_query() result is sufficient:
Returns FALSE on failure. For successful SELECT, SHOW, DESCRIBE or EXPLAIN queries mysqli_query() will return a mysqli_result object. For other successful queries mysqli_query() will return TRUE.
so (mind the comparision operator!)
if( mysqli_query("....") !== false ) {
// ok
} else {
// zonk
}