cdiego

video_12_mapas.php

Aug 28th, 2013
891
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.09 KB | None | 0 0
  1. <?php
  2. include_once 'conex.php';//INCLUIR CONEXION DE BASE DE DATOS
  3.  
  4. class puntosDao
  5. {
  6.     private $r;
  7.     public function __construct()
  8.     {
  9.         $this->r = array();
  10.     }
  11.     public function grabar($titulo, $cx,$cy)//METODO PARA GRABAR A LA BD
  12.     {
  13.         $con = conex::con();
  14.         $titulo = mysql_real_escape_string($titulo);
  15.         $cx = mysql_real_escape_string($cx);
  16.         $cy = mysql_real_escape_string($cy);
  17.         $q = "insert into puntos (Titulo, cx, cy)".
  18.              "values ('".addslashes($titulo)."','".addslashes($cx)."','".addslashes($cy)."')";
  19.         $rpta = mysql_query($q, $con);
  20.         mysql_close($con);
  21.         if($rpta==1)
  22.         {
  23.             return TRUE;
  24.         }
  25.         else
  26.         {
  27.             return FALSE;
  28.         }
  29.     }
  30.     public function listar_todo()
  31.     {
  32.         $q = "select * from puntos";
  33.         $con = conex::con();
  34.         $rpta = mysql_query($q,$con);
  35.         mysql_close($con);
  36.         while($fila = mysql_fetch_assoc($rpta))
  37.         {
  38.             $this->r[] = $fila;
  39.         }
  40.         return $this->r;
  41.     }
  42. }
  43. ?>
Advertisement
Add Comment
Please, Sign In to add comment