Exemplo n.º 1
0
 public function Obtain($id_shop)
 {
     try {
         $query = $this->pdo->prepare('SELECT * FROM Tiendas WHERE id_shop = ?');
         $query->execute(array($id_shop));
         $r = $query->fetch(PDO::FETCH_OBJ);
         $shop = new Shop();
         $shop->__SET('id_shop', $r->id_shop);
         $shop->__SET('name', $r->name);
         $shop->__SET('description', $r->description);
         $shop->__SET('tel_number', $r->tel_number);
         $shop->__SET('iframe', $r->iframe);
         $shop->__SET('image', $r->image);
         $shop->__SET('active', $r->active);
         return $shop;
     } catch (Exception $e) {
         die($e->getMessage());
     }
 }
Exemplo n.º 2
0
 
             echo "<script type=\"text/javascript\">
             alert('Se ha añadido correctamente a la base de datos una nueva noticia');
             history.go(-2);
             </script>";
             exit;
         }
     }*/
 if (isset($_REQUEST['action'])) {
     //echo "<script type=\"text/javascript\">
     //        alert('Comprobando valores...');
     //        </script>";
     switch ($_REQUEST['action']) {
         case 'update':
             //$shop->__SET('id_shop'      , $_REQUEST['id_shop']);
             $shop->__SET('name', $_REQUEST['name']);
             $shop->__SET('description', $_REQUEST['description']);
             $shop->__SET('tel_number', $_REQUEST['tel_number']);
             $shop->__SET('iframe', $_REQUEST['iframe']);
             $shop->__SET('image', $_REQUEST['image']);
             $shop->__SET('active', $_REQUEST['active']);
             $shopModel->Update($shop);
             echo "<script type=\"text/javascript\">\n                alert('¡El registro se ha actualizado exitosamente!');\n                history.go(-2);\n                </script>";
             break;
         case 'insert':
             //$shop->__SET('id_shop'      , $_REQUEST['id_shop']);
             $shop->__SET('name', $_REQUEST['name']);
             $shop->__SET('description', $_REQUEST['description']);
             $shop->__SET('tel_number', $_REQUEST['tel_number']);
             $shop->__SET('iframe', $_REQUEST['iframe']);
             $shop->__SET('image', $_REQUEST['image']);