Sort query results by Field1 Field2 Field3 ASC and DESC so

Hello friends, I need the help I can get, I have a filter on my site and let me know how I can sort the results leaked to the mysql database and so Field1 Field2 Field3 ASC and DESC

and desire to create the value of selection option on the form for users to decide whether ASC or DESC order filter and option value for each field selection

```
          <?php

$o      = '';
// Pon la información correspondiente:
$data   = array( 'localhost', 'user', 'password' );
$con    = mysql_connect( $data[0], $data[1], $data[2] );

if( ! $con ) {
    $o = 'Error: no se pudo conectar con el servidor. ' . mysql_error();
    echo $o;
    exit;
}

// Cambia el nombre de la base de datos por la tuya
$db_name = 'database';

if( ! mysql_select_db( $db_name, $con ) ) {
    $o = 'Error: no se pudo seleccionar la base de datos "' . $db_name . '". ' . mysql_error();
    echo $o;
    exit;
}

$table = 'users'; // Cambia este SÓLO si sabes lo que hace.
$query = "SELECT * FROM $table";
$where = " WHERE";
$and     = 0;

if( isset( $_GET['Nombre'] ) && ! empty( $_GET['Nombre'] ) ) {
    $where .= " Nombre LIKE '%$_GET[Nombre]%'";
    $and        = 1;
}

if( isset( $_GET['Tarifa'] ) ) {
    $e = explode( ' - ', $_GET['Tarifa'] );

    if( is_numeric( $e[0] ) && is_numeric( $e[1] ) ) {
        if( $and === 1 )
            $where .= " AND";

        $where .= " Tarifa BETWEEN $e[0] AND $e[1]";
        $and        = 1;
    }
}

if( isset( $_GET['Edad'] ) ) {
    $e = explode( ' - ', $_GET['Edad'] );

    if( is_numeric( $e[0] ) && is_numeric( $e[1] ) ) {
        if( $and === 1 )
            $where .= " AND";

        $where .= " Edad BETWEEN $e[0] AND $e[1]";
        $and        = 1;
    }
}

if( isset( $_GET['Estatura'] ) ) {
    $e = explode( ' - ', $_GET['Estatura'] );

    if( is_numeric( $e[0] ) && is_numeric( $e[1] ) ) {
        if( $and === 1 )
            $where .= " AND";

        $where .= " Estatura BETWEEN $e[0] AND $e[1]";
        $and        = 1;
    }
}

if( isset( $_GET['Peso'] ) ) {
    $e = explode( ' - ', $_GET['Peso'] );

    if( is_numeric( $e[0] ) && is_numeric( $e[1] ) ) {
        if( $and === 1 )
            $where .= " AND";

        $where .= " Peso BETWEEN $e[0] AND $e[1]";
        $and        = 1;
    }
}

if( isset( $_GET['Ciudad'] ) && !empty( $_GET['Ciudad'] ) ) {
    if( $and === 1 )
        $where .= " AND";

    $where .= " Ciudad = '$_GET[Ciudad]'";
    $and        = 1;
}

if( isset( $_GET['Ojos'] ) && !empty( $_GET['Ojos'] ) ) {
    if( $and === 1 )
        $where .= " AND";

    $where .= " Ojos = '$_GET[Ojos]'";
    $and        = 1;
}

if( isset( $_GET['Cabello'] ) && !empty( $_GET['Cabello'] ) ) {
    if( $and === 1 )
        $where .= " AND";

    $where .= " Cabello = '$_GET[Cabello]'";
    $and        = 1;
}

if( strlen( $where ) > 6 )
    $query .= $where;

$result = mysql_query( $query, $con);

if( $result ) {
    $nrows  = mysql_num_rows( $result );

    if( $nrows > 0 ) {
        $o = '';

        while( $row = mysql_fetch_assoc( $result ) ) {

            $o .= "$row[Imagen]";
        }

        $o .= "";
    } else {
        $o = 'No hubieron resultados';
    }
} else {
    $o = 'Error: no se ejecutó la consulta. ' . mysql_error( $con );
}

mysql_free_result( $result );
mysql_close( $con );
echo $o . "";
exit;
       ?>

```