Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created October 30, 2020 23:34
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save parzibyte/dc1338f2589c193b5383fd464fc22d66 to your computer and use it in GitHub Desktop.
<?php
function obtenerBaseDeDatosWordPress()
{
$pass = "";
$usuario = "root";
$nombreBaseDeDatos = "wp";
$baseDeDatos = new PDO('mysql:host=localhost;dbname=' . $nombreBaseDeDatos, $usuario, $pass);
$baseDeDatos->query("set names utf8;");
$baseDeDatos->setAttribute(PDO::ATTR_EMULATE_PREPARES, FALSE);
$baseDeDatos->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$baseDeDatos->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
return $baseDeDatos;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment