Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created Oct 30, 2020
Embed
What would you like to do?
<?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