• <?php
  • $servername = "localhost";
  • $username = "root";
  • $password = "";
  • $dbname = "test_db";
  •  
  • // Create connection
  • $conn = new mysqli($servername, $username, $password,$dbname);
  •  
  • // Check connection
  • if ($conn->connect_error) {
  •     die("Connection failed: " . $conn->connect_error);
  • }
  •  
  • // prepare and bind
  • $stmt = $conn->prepare("INSERT INTO complaints (expedient, detail, fecha) VALUES (?, ?, ?)");
  • $stmt->bind_param("sss", $expediente,$descripcion_denuncia, $fecha);
  •  
  • // set parameters and execute
  • $expediente = "ABC";
  • $descripcion_denuncia = "DEF";
  • $fecha = "1870-01-32";
  • if ($stmt->execute()) {
  •    echo "success";
  • } else {
  •    echo $stmt->error;
  • }
  •  
  • $stmt->close();
  • $conn->close();
  • ?>
  • Comments

    Popular posts from this blog

    How to Upload Website from Localhost to Server with Filezila