Beispiel #1
0
 public function fetch($query)
 {
     return parent::fetch_array($query);
 }
Beispiel #2
0
<?php

require_once "mysql.class.php";
$Mysql = new Mysql();
while (true) {
    $requestedTimestamp = isset($_GET['timestamp']) ? (int) $_GET['timestamp'] : null;
    // o PHP faz cache de operações "stat" do filesystem. Por isso, devemos limpar esse cache
    //clearstatcache(); // retirar depois
    //$modifiedAt = filemtime( $dataFileName ); //usar somente se for pegar dados de um arquivo
    $query = $Mysql->sql_query("select * from teste order by id DESC");
    $linha = $Mysql->fetch_array($query);
    $modifiedAt = time($linha['hora']);
    if ($requestedTimestamp == null || $modifiedAt > $requestedTimestamp) {
        //$data = file_get_contents( $dataFileName ); //pega conteúdo do arquivo, se os dados estiverem em um arquivo
        $arrData = array('content' => $linha['mensagem'], 'timestamp' => $modifiedAt, 'nick' => $linha['apelido']);
        $json = json_encode($arrData);
        echo $json;
        break;
    } else {
        sleep(2);
        continue;
    }
}
Beispiel #3
0
    $inicio = 0;
}
$mysql = new Mysql();
$mysql->conexion();
// Creamos la variable consulta que nos servira como argumento en los metodos num_rows y fetch_array
$consulta = $mysql->consulta("SELECT * from empleados limit {$inicio},3");
//si existe por lo menos un campo
if ($mysql->num_rows($consulta) > 0) {
    echo "se encontraron valores";
    //Guardaremos en la variable $resultado en Array que nos devuelva
    ?>
  <table id="resultados" border=1px>
	<tr><td>Cedula</td><td>nombre</td><td>telefono y celular</td><td>Cedula</td><td>Cedula</td><td>Cedula</td></tr>
	<?php 
    $impresos = 0;
    while ($resultado = $mysql->fetch_array($consulta)) {
        $impresos++;
        ?>
		<tr><td><?php 
        echo $resultado['Cedula'];
        ?>
</td><td><?php 
        echo $resultado['Nombres'];
        ?>
</td><td><?php 
        echo $resultado['Telefono'];
        ?>
 , <?php 
        echo $resultado['Celular'];
        ?>
</td></tr>