Skip to content

Instantly share code, notes, and snippets.

@NoMan2000
Created December 8, 2013 19:44
Show Gist options
  • Save NoMan2000/7862909 to your computer and use it in GitHub Desktop.
Save NoMan2000/7862909 to your computer and use it in GitHub Desktop.
Basic PHP Functions
<?php
function redirect_to($new_location) {
header("Location: " . $new_location);
exit;
}
// This function will sanitize a string. Requires a connection.
function mysql_prep($string) {
global $connection;
$escaped_string = mysqli_real_escape_string($connection, $string);
return $escaped_string;
}
function confirm_query($result_set) {
if (!$result_set) {
die("Database query failed.");
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment