<?php



function conect() {

    $host = "localhost";

    $user = "condomin_puerto";

    $password = "PuertoCa2013";

    $base = "condomin_puertocancun";



    $connection = mysql_connect($host, $user, $password);

    mysql_select_db($base, $connection);

    mysql_query("SET NAMES 'iso-8859-1'");

    return $connection;

}



function get_array($query) {  //Returns an array with the results of a query in the form

//$array[key][row] being key the name of the column

    $connection = conect();

    $result = mysql_query($query, $connection) or die(mysql_error());



    $number_cols = mysql_num_fields($result);



    for ($i = 0; $i < $number_cols; ++$i) {

        $cols[$i] = mysql_field_name($result, $i);

    }



    $c1 = 0;

    $c2 = 0;

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

        foreach ($row as $field) {

            $array[$cols[$c2]][$c1] = (is_null($field) ? '&nbsp;' : $field);

            $c2++;

        }

        $c2 = 0;

        $c1++;

    }



    return $array;

}



function execSQL($query) {  //Returns an array with the results of a query in the form

//$array[key][row] being key the name of the column

    $connection = conect();

    $result = mysql_query($query, $connection) or die(mysql_error());

}