Page 1 sur 1

Parse error: syntax error, unexpected end of file in C:\wamp64\www\livre-or-partie-1\functions\database.fn.php on line

Posté : 11 nov. 2018, 15:52
par PaleHorn
Bonjour,
j'ai un problème avec mon PHP! Je cherche depuis une bonne heure le problème mais je ne le trouve pas .

Pourriez-vous m'aider ?

Voici mon problème :
( ! ) Parse error: syntax error, unexpected end of file in C:\wamp64\www\livre-or-partie-1\functions\database.fn.php on line 44

Code : Tout sélectionner

<?php function getPDOLink($config) { $dsn = 'mysql:dbname='.$config['database'].';host='.$config['host'].';port='.$config['port']; return new PDO($dsn, $config['username'],$config['password']); } function getPDOLink($config) { try { $dsn = 'mysql:dbname='.$config['database'].';host='.$config['host'].';port='.$config['port'].';charset=utf8'; return new PDO($dsn,$config['username'],$config['password']); } catch (PDOException $exception) { /* * Envoyez-vous un email en cas de problèmes de connexion sur votre site! */ mail('[email protected]', 'BDD Error', $exeption->getMessage()); exit('BDD Error Connection'); } function findAll(PDO $pdo, array $data) { $sql = "SELECT * FROM livre_or ORDER BY id DESC"; $result = $pdo->query($sql); return $result->fetchAll(PDO::FETCH_ASSOC); } function add(PDO $pdo, array $data) { $sql = "INSERT INTO livre_or (id, pseudo, email, website, message, ip) VALUES (NULL,".$data['pseudo'].",".$data['email']."," .$data['website'].",".$data['message'].",".$data['ip'].")"; return $pdo->exec($sql); } function add(PDO $pdo, array $data) { $pseudo = $pdo->quote($data['pseudo']); $email = $pdo->quote($data['email']); $website = $pdo->quote($data['website']); $message = $pdo->quote($data['message']); $ip = $pdo->quote($data['ip'], PDO::PARAM_INT); $sql = "INSERT INTO livre_or (id, pseudo, email, website, message, ip) VALUES (NULL, $pseudo, $email, $website, $ip)"; return $pdo->exec($sql); } ?>

Re: Parse error: syntax error, unexpected end of file in C:\wamp64\www\livre-or-partie-1\functions\database.fn.php on li

Posté : 11 nov. 2018, 18:26
par Saian
Il manque une accolade :mrgreen:

Re: Parse error: syntax error, unexpected end of file in C:\wamp64\www\livre-or-partie-1\functions\database.fn.php on li

Posté : 11 nov. 2018, 19:09
par or 1
5 fonctions, mais seulement 4 } en tout début de ligne, c'est bien fait cet affichage du code.