Created
December 8, 2013 19:44
-
-
Save NoMan2000/7862909 to your computer and use it in GitHub Desktop.
Basic PHP Functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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