Skip to content

Instantly share code, notes, and snippets.

@lithid
Created February 2, 2012 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lithid/1725081 to your computer and use it in GitHub Desktop.
Save lithid/1725081 to your computer and use it in GitHub Desktop.
$ndb = mysqli_connect (
'localhost',
'user',
'pw',
'db') or die ('Error connecting. Check yo factz!');
$output_form = false;
$content=$_POST['content'];
$content = mysql_real_escape_string($content);
if (isset($_POST['submit'])) {
$query = "INSERT INTO table (content)" .
"VALUES ('$content')";
$result = mysqli_query($ndb, $query)
or die ('Error writing to database');
mysqli_close($ndb);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment