Tema: Web sql
Ver Mensaje Individual
  #9 (permalink)  
Antiguo 02/02/2015, 10:42
grossbergsteven
 
Fecha de Ingreso: diciembre-2014
Mensajes: 69
Antigüedad: 9 años, 4 meses
Puntos: 2
Respuesta: Web sql

Si específicamente es Web Sql de HTML5 ya he logrado algo les pongo el código a ver si a alguien le sirve, al solucionarlo por completo subo todo el código como contribución


Código HTML:
Ver original
  1. <!DOCTYPE HTML>
  2.   <meta charset="utf-8">
  3.   <title>NBA</title>
  4.   <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
  5.   <script type="text/javascript">
  6. var db = openDatabase('logros540', '1.0', 'Logros', 1024);
  7. var msg;
  8. db.transaction(function (tx) {
  9.   tx.executeSql('CREATE TABLE IF NOT EXISTS juego (id unique, fecha, deporte, status, id_liga, id_deporte, id_inca)');
  10.   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)');
  11.   tx.executeSql('CREATE TABLE IF NOT EXISTS score (id, id_juego, nombre)');
  12.   tx.executeSql('INSERT INTO juego (fecha) VALUES ("02/02/2015")');
  13.   tx.executeSql('INSERT INTO logro (referencia, nombre) VALUES ("23571", "Chicago Bull")');
  14.   //tx.executeSql('INSERT INTO juego (id, fecha) VALUES (4, "02/02/2015")');
  15. });
  16. db.transaction(function (tx) {
  17.   tx.executeSql('SELECT * FROM juego', [], function (tx, results) {
  18.    var len = results.rows.length, i;
  19.    for (i = 0; i < len; i++){
  20.    msg = "<td>"+ results.rows.item(i).fecha + "</td>";
  21.      document.querySelector('#status').innerHTML +=  msg;
  22.    }
  23.  }, null);//cierre de funcion
  24. });
  25. db.transaction(function (tx) {
  26.   tx.executeSql('SELECT * FROM logro', [], function (tx, results) {
  27.    var len = results.rows.length, i;
  28.    for (i = 0; i < len; i++){
  29.    msg = "<td>" + results.rows.item(i).referencia + "</td>" + "<td>" + results.rows.item(i).nombre + "</td>";
  30.      document.querySelector('#status').innerHTML +=  msg;
  31.    }
  32.  }, null);//cierre de funcion
  33. });
  34. </head>
  35.   <table id="status" border="1 px">
  36.     <tr>
  37.       <td colspan=3></td>
  38.       <td colspan= 3>Juego completo</td>
  39.       <td colspan= 3>Primera mitad</td>
  40.     </tr>
  41.     <tr>
  42.       <td>Fecha/Hora</td>
  43.       <td>Ref</td>
  44.       <td>Equipo</td>
  45.       <td>ML</td>
  46.       <td>A/B</td>
  47.       <td>RL</td>
  48.       <td>ML</td>
  49.       <td>A/B</td>
  50.       <td>RL</td>
  51.     </tr>
  52.   </table>
  53. </body>
  54. </html>