Skip to content

Instantly share code, notes, and snippets.

@asathoor
Created September 26, 2017 10:17
Show Gist options
  • Save asathoor/3fe79d88f8f7d8b91ef8a99a6eafcbf8 to your computer and use it in GitHub Desktop.
Save asathoor/3fe79d88f8f7d8b91ef8a99a6eafcbf8 to your computer and use it in GitHub Desktop.
Insert
<?php
/**
* file: action.php
* purpose: INSERT INTO
**/
$sql = "INSERT INTO `navne` (`navne_id`, `fornavn`, `efternavn`, `email`) VALUES (NULL, '" . $_GET['firstName'] . "', '".$_GET['lastName']."', '". $_GET['gender'] ."')";
echo $sql;
require_once "db.php"; // database connect
if($_GET) {
// INSERT
if( $insert = $mysqli->query($sql) ){
echo "<p>New actor added: $fn $ln - Gee thanx a lot.</p>";
echo "<h2>SQL</h2> <pre>" . $sql ."</pre>";
} else {
echo "INSERT not possible. Check your SQL.";
}
}
else {
echo "<p>Error: Use the form please. No GET got.</p>";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment