Skip to content

Instantly share code, notes, and snippets.

@karellism
Created November 1, 2015 02:40
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 karellism/e33b8a4843c15a5192dd to your computer and use it in GitHub Desktop.
Save karellism/e33b8a4843c15a5192dd to your computer and use it in GitHub Desktop.
Saving the data to the database for simple CMS - php file
public function write($p) {
if ( $p['title'] )
$title = mysql_real_escape_string($p['title']);
if ( $p['bodytext'])
$bodytext = mysql_real_escape_string($p['bodytext']);
if ( $title && $bodytext ) {
$created = time();
$sql = "INSERT INTO testDB VALUES('$title','$bodytext','$created')";
return mysql_query($sql);
} else {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment