Tema: Web SQL
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/01/2015, 09:31
grossbergsteven
 
Fecha de Ingreso: diciembre-2014
Mensajes: 69
Antigüedad: 9 años, 4 meses
Puntos: 2
Exclamación Web SQL

Buenos días, se que una de las caracteristicas del HTML 5 es poder crer bases dedatos locales, mi consulta es la siguiente, quiero crear una base de datos local, insertarle datos y luego mostrar esos datos en una tabla html, he preparado algo de codigo pero me falta la consulta, quien me pueda ayudar se lo agradezco muchisimo

Código PHP:
<!DOCTYPE html>
<
html>
<
head>
    <
meta charset="utf-8">
    <
title>NBA</title>
    <
script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <link rel="stylesheet" href="">
    <script type="text/javascript">
    var db = openDatabase("logros", "1.0", "", 2 * 1024 * 1024);
    db.transaction(function (tx) {
      tx.executeSql('CREATE TABLE IF NOT EXISTS juego (id unique, fecha, deporte, status, id_liga, id_deporte, id_inca)');
      tx.executeSql('CREATE TABLE IF NOT EXISTS logro (id unique, id_juego, referencia, id_equipo, nombre, ml, rl, rll, srl, srll, ab, abl, pml, prl, prll, pab, pabl, inning, anota, gt, gtl)');
      tx.executeSql('CREATE TABLE IF NOT EXISTS score (id unique, id_juego, nombre)');
      tx.executeSql('INSERT INTO juego (id, fecha) VALUES (1, "Chicago Bull")');
});
  db.transaction(function (tx) {
   tx.executeSql('SELECT * FROM logro', [], function (tx, results) {
   var n1 = results.rows.length, i;
   msg = "<p>Found rows: " + len + "</p>";
   document.querySelector('#status').innerHTML +=  msg;
   for (i = 0; i < len; i++){
      alert(results.rows.item(i).log );
   }
 }, null);
});

    </script>
</head>
<body>
    <table id="logros" border="1 px">
    <tr>
      <td colspan=3></td>
      <td colspan= 3>Juego completo</td>
      <td colspan= 3>Primera mitad</td>
    </tr>
    <tr>
      <td>Fecha/Hora</td>
      <td>Ref</td>
      <td>Equipo</td>
      <td>ML</td>
      <td>A/B</td>
      <td>RL</td>
      <td>ML</td>
      <td>A/B</td>
      <td>RL</td>
    </tr>
  </table>
</body>
</html>