Explorar el Código

Completando index.php

Okynos hace 9 años
padre
commit
93ae222c76
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      index.php

+ 3 - 1
index.php

@@ -19,11 +19,13 @@
     <?php
       $c = new MongoClient( "mongodb://docker.ugr.es:15074" );
       $db = $c->test->elements;
+
       if(isset($_GET['remove']){
         $db->remove( array('name' => $_GET['remove']) );
-      }else if(isset($_GET['insert'])){
+      }elseif(isset($_GET['insert'])){
         $db->insert( array('name' => $_POST['name'], 'email' => $_POST['email']) );
       }
+
       $cursor = $db->find();
       foreach ($cursor as $documento) {
         echo "* Nombre:" . $documento["name"] . " - E-mail:" . $documento["email"] . " <a href='index.php?remove=".$documento["name"]."'>Eliminar usuario</a>\n";