-2
I’m having trouble connecting , where it presents the following error:
Parse error: syntax error, Unexpected end of file in /var/www/html/showdospes.com.br/web/funcao/conecta.php on line 27
where line 27 does not exist only goes up to 26, what is the correct way to close the script ? Aki the code:
<?php
function conecta( ){
if(!defined("HOST")){
define('HOST','localhost');
}
if(!defined("BD")){
define('BD','bala');
}
if(!defined("USER")){
define('USER','bombom');
}
if(!defined("PASS")){
define('PASS','chocolate');
}
try {
$conn = new PDO('mysql:hostname='.HOST.';dbname='.BD.';port=3306','.USER.','.PASS.');
}catch(Exception $e){
echo $e -> getmessage();
}
return $conn;
}
you’re using this script ai to connect in a BD? you’ve heard of PDO?
– Leandro
I do not know if it was right but the script It is in PDO.,use to connect my local bank that works , but online presents this error.
– Clayton Campos
Possible duplicate of: Script returning Parse error: syntax error, Unexpected end of file
– rray
Which is line 26?
– rray
nor need these "if" ai, can take.
– Leandro