function Delete($mysqli,$table_name, $where_clause='')
{   
    //global $mysqli;
    // check for optional where clause
    $whereSQL = '';
    if(!empty($where_clause))
    {
        // check to see if the 'where' keyword exists
        if(substr(strtoupper(trim($where_clause)), 0, 5) != 'WHERE')
        {
            // not found, add keyword
            $whereSQL = " WHERE ".$where_clause;
        } else
        {
            $whereSQL = " ".trim($where_clause);
        }
    }
    // build the query
    $sql = "DELETE FROM `".$table_name."` ".$whereSQL;
     
    // run and return the query result resource
    return mysqli_query($mysqli,$sql);
}