Viewing file: class_data_register.php (1.27 KB) -rw-rw-rw- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
class data_register {
function data_register ($campo_id, $id, $select_reg, $tabla, $n_c)
{
$this->CAMPO_ID = $campo_id;
$this->ID = $id;
$this->SELECT_REG = $select_reg;
$this->TABLA = $tabla;
// Ejemplo de consulta
// Portel 1.0
// 0. Extrae el número de campos solicitados
$campos = substr_count($select_reg, ',');
$campos++;
// 1. Consulta de Numero de Resultados
$cuando = $campo_id . "=" . $id;
$query = "select count(*) from " . $tabla . " where " . $cuando;
$select_1 = new Select($query, 1, $inicio ,0);
// 2. Definir Query Real (encuentra los resultados deseados)
$query = "select " . $select_reg . " from " . $tabla . " where " . $campo_id . "=" . $id;
$select = new Select($query, $n_c, $inicio ,0);
// 3. Extrae los resultados en un arreglo de dos dimensiones
$resultados = $select->RESULTADO;
$this->RESULTADOS = $select->RESULTADO;
$this->NUMERO_REGISTROS = $select->NUMERO_REGISTROS;
// 4. Compone el string final
$this->STRING_REG = "";
for ($i = 0; $i < $campos; $i++) {
$temp = $resultados[0][$i];
$this->STRING_REG = $this->STRING_REG . "-" . $temp;
}
}
}
?>
|