Problemi con delle variabili!

di il
1 risposte

Problemi con delle variabili!

Mi dice :
Notice: Undefined index: lt in C:\xampp\htdocs\prova\PHP\PHP_webserver\index.php on line 15

Notice: Undefined index: ln in C:\xampp\htdocs\prova\PHP\PHP_webserver\index.php on line 16

Notice: Undefined index: d in C:\xampp\htdocs\prova\PHP\PHP_webserver\index.php on line 17

Notice: Undefined index: n in C:\xampp\htdocs\prova\PHP\PHP_webserver\index.php on line 18
Execute failed: (1048) Column 'Latitude' cannot be null

ecco il codice:
che problema ci stà sulle variabili?
?php
   $mysqli = new mysqli('localhost', 'root', 'ilcolosso84', 'geolog');
   if ($mysqli->connect_errno) {
      echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
      exit();
   }

   if (!($stmt = $mysqli->prepare("INSERT INTO entries(Latitude, Longitude, Device, Annotation) VALUES (?, ?, ?, ?)"))) {
       echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
   }
  
   $latitude   = $_GET['lt'];
   $longitude  = $_GET['ln'];
   $device     = $_GET['d'];
   $annotation = $_GET['n'];
   
   if (!$stmt->bind_param("ddss", $latitude, $longitude, $device, $annotation)) {
      echo "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
   }

   if (!$stmt->execute()) {
       echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
   }   

   $stmt->close();
   mysqli_close($mysqli);
?>

1 Risposte

Devi accedere o registrarti per scrivere nel forum
1 risposte