Created
December 21, 2015 13:52
-
-
Save juanwilde/fa56512dfe8e6e8e1896 to your computer and use it in GitHub Desktop.
Patrón MVC básico
This file contains hidden or 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
protected function getSql($key) | |
{ | |
if (isset($_POST[$key]) && !empty($_POST[$key])) { | |
$_POST[$key] = strip_tags($_POST[$key]); | |
if (!get_magic_quotes_gpc()) { | |
$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); | |
if ($mysqli->connect_error) { | |
die('Connection error (' . $mysqli->connect_errno . ') ' | |
. $mysqli->connect_error); | |
} else { | |
$_POST[$key] = $mysqli->real_escape_string($_POST[$key]); | |
} | |
} | |
return trim($_POST[$key]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment