pastebin
| #1 paste tool since 2002
create new paste
tools
api
archive
real-time
faq
pastebin
Follow @pastebin
create new paste
trending pastes
sign up
login
my settings
my profile
My Pastes
Public Pastes
Watch Fulham vs Stoke L...
21 sec ago
Untitled
8 sec ago
%$%Watch Manchester Uni...
26 sec ago
Untitled
14 sec ago
Untitled
21 sec ago
Change attributes of ch...
22 sec ago
American History X DIVX...
22 sec ago
Εξαρτηματα
36 sec ago
Layout Width
Share Pastebin
Tutorial City
By: a guest | Feb 11th, 2010 | Syntax:
PHP
| Size: 0.40 KB | Hits: 1,605 | Expires: Never
Download
|
Raw
|
Embed
|
Report abuse
<?php
define
(
'HOST'
,
'localhost'
)
;
define
(
'DB_NAME'
,
'pdo'
)
;
define
(
'USER'
,
'eduardo'
)
;
define
(
'PASS'
,
'php_data_objects'
)
;
$dsn
=
'mysql:host='
.
HOST
.
';dbname='
.
DB_NAME
;
try
{
$bd
=
new
PDO
(
$dsn
,
USER
,
PASS
)
;
$bd
->
setAttribute
(
PDO
::
ATTR_ERRMODE
,
PDO
::
ERRMODE_EXCEPTION
)
;
}
catch
(
PDOException
$e
)
{
echo
htmlentities
(
'Houve algum erro com a conexo com o banco de dados: '
.
$e
->
getMessage
(
)
)
;
}
create new paste
|
create new version of this paste
RAW Paste Data