Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php class query_sql {
- protected static $conect;
- private function __construct() {
- $mysql_host = "";
- $mysql_base = "";
- $mysql_user = "";
- $mysql_pass = "";
- try { self::$conect = new PDO("mysql:host=" . $mysql_host . "; dbname=" . $mysql_base, $mysql_user, $mysql_pass);
- self::$conect -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- self::$conect -> exec("set names utf8");
- $conect = null; }
- catch(PDOException $error) {
- echo $error -> getMessage(); } }
- public static function conect_sql() {
- if (!self::$conect) {
- new query_sql; }
- return self::$conect; } }
- $bind_sql = query_sql::conect_sql(); ?>
- $mysql_host = "";
- $mysql_base = "";
- $mysql_user = "";
- $mysql_pass = "";
- <?php $list_information = $bind_sql -> prepare("SELECT user_email, user_name FROM usuarios WHERE user_email = :user_email LIMIT 1");
- $list_information -> bindValue(":user_email", "@");
- $list_information -> execute();
- $list_information = $list_information -> fetchAll(); ?>
- <?php $compare_information = $bind_sql -> prepare("SELECT user_email, user_name FROM usuarios WHERE user_email = :user_email AND user_name = :user_name LIMIT 1");
- $statement_array = array(":user_email" => "@", ":user_name" => "*");
- foreach($statement_array as $array_key => $array_value) {
- $compare_information -> bindValue($array_key, $array_value); }
- $compare_information -> execute();
- $compare_information = $compare_information -> fetchAll(); ?>
- <?php foreach($list_information as $list_information) {
- echo $list_information["user_email"] . " | " . $list_information["user_name"]; } ?>
- <?php foreach($compare_information as $compare_information) {
- echo $compare_information["user_email"] . " | " . $compare_information["user_name"]; } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement