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
| <?php | |
| $options = array( | |
| "username" => "usuario", | |
| "password" => "password", | |
| "host" => "localhost", | |
| "dbname" => "base de datos", | |
| ); | |
| // Ejemplo en CONEXIÓN PDO | |
| $db = new PDO("mysql:dbname=".$options["dbname"].";host=".$options["host"], $options["username"], $options["password"]); |
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
| <?php | |
| // Ejemplo en CONEXIÓN PDO | |
| $db = new PDO("mysql:dbname=DB_NAME;host=localhost", USERNAME , PASSWORD); | |
| $db->exec("SET NAMES utf8"); | |
| //CONSULTAS | |
| // El signo de interregación representa donde se colocara el dato | |
| $stmt = $db->prepare('SELECT id, CI FROM habitantes WHERE CI= ?'); |
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
| <?php | |
| phpinfo(); |
NewerOlder