[PDO] connexion à une base de donnée
-
<p>Bonjour,<br/>
voici un code tout fait pour vous connecter à votre base de donnée
<br/>
<br/>
</p>
<pre class="ipsCode prettyprint">
<?php
define("HOTE","localhost"); // hôte
define("DBNAME","test"); // nom de la base de donnée
define("USER", "root"); // Utilisateur
define("PASS", ""); // Mot de passetry {
$db = new PDO("mysql:host=".HOTE.";dbname=".DBNAME."", USER, PASS);
} catch(PDOException $erreur)
{
print "Erreur :". $erreur-> getMessage() . "<br />"; // en cas d'erreur on renvoit l'erreur.
}?>
</pre>
<p>Je suis ouvert à tous conseils !
</p> -
<p>Merci pour ce script !
</p>
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login