Probleme liaison table SQL et page PHP (1AND1)

  • Auteur de la discussion Auteur de la discussion NoIPro
  • Date de début Date de début
Nouveau WRInaute
Bonjour,

J'ai un gros problème, je n'arrive pas a régler ma connexion a ma table SQL, je ne vois pas ce que j'ai fait de mal, je compte sur votre aide pour trouver mon erreur car j'avoue avoir passer deux jours a essayer de m'en sortir seul mais la je suis épuisé^^.

Merci beaucoup .


Voila ma page livre.php :

PHP:
<span class="syntaxhtml"><span class="syntaxdefault"><?php<br /></span><span class="syntaxkeyword">if(isset(</span><span class="syntaxdefault">$_POST</span><span class="syntaxkeyword">[</span><span class="syntaxstring">'submit'</span><span class="syntaxkeyword">]))<br />{<br />if(!empty(</span><span class="syntaxdefault">$_POST</span><span class="syntaxkeyword">[</span><span class="syntaxstring">'nom'</span><span class="syntaxkeyword">])&&!empty(</span><span class="syntaxdefault">$_POST</span><span class="syntaxkeyword">[</span><span class="syntaxstring">'email'</span><span class="syntaxkeyword">])&&!empty(</span><span class="syntaxdefault">$_POST</span><span class="syntaxkeyword">[</span><span class="syntaxstring">'message'</span><span class="syntaxkeyword">]))<br />{<br /></span><span class="syntaxdefault">    $nom</span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> mysql_real_escape_string</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">htmlentities</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">trim</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">$_POST</span><span class="syntaxkeyword">[</span><span class="syntaxstring">'nom'</span><span class="syntaxkeyword">])));<br /></span><span class="syntaxdefault">    $email</span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> mysql_real_escape_string</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">htmlentities</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">trim</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">$_POST</span><span class="syntaxkeyword">[</span><span class="syntaxstring">'email'</span><span class="syntaxkeyword">])));<br /></span><span class="syntaxdefault">    $message</span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> mysql_real_escape_string</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">htmlentities</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">trim</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">$_POST</span><span class="syntaxkeyword">[</span><span class="syntaxstring">'message'</span><span class="syntaxkeyword">])));<br /></span><span class="syntaxdefault">    <br />    if</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">strlen</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">$nom</span><span class="syntaxkeyword">)></span><span class="syntaxdefault">25</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">    </span><span class="syntaxkeyword">{<br /></span><span class="syntaxdefault">        echo</span><span class="syntaxstring">"Votre nom ne doit pas dépasser les 25 caracteres"</span><span class="syntaxkeyword">;<br /></span><span class="syntaxdefault">    </span><span class="syntaxkeyword">}</span><span class="syntaxdefault">else if </span><span class="syntaxkeyword">(!</span><span class="syntaxdefault">filter_var</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">$email</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">FILTER_VALIDATE_EMAIL</span><span class="syntaxkeyword">)){<br /></span><span class="syntaxdefault">    echo</span><span class="syntaxstring">"Veuillez saisir un email valide"</span><span class="syntaxkeyword">;<br />}</span><span class="syntaxdefault">else if</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">strlen</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">$message</span><span class="syntaxkeyword">)></span><span class="syntaxdefault">100</span><span class="syntaxkeyword">){<br /></span><span class="syntaxdefault">    echo</span><span class="syntaxstring">"Votre message ne doit pas dépasser les 500 caracteres"</span><span class="syntaxkeyword">;<br />}else<br /><br /><br /></span><span class="syntaxdefault">$connect </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> mysql_connect</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'/tmp/mysql5.sock'</span><span class="syntaxkeyword">,</span><span class="syntaxstring">'dboXXXXXXX'</span><span class="syntaxkeyword">,</span><span class="syntaxstring">'MONMOTDEPASSE'</span><span class="syntaxkeyword">);<br /></span><span class="syntaxdefault">mysql_select_db</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'dbXXXXXX'</span><span class="syntaxkeyword">);<br /><br /></span><span class="syntaxdefault">$query </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> mysql_query</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"INSERT INTO livredor (id,nom,email,message) VALUES('','$nom','$email','$message')"</span><span class="syntaxkeyword">);<br />if(</span><span class="syntaxdefault">$query</span><span class="syntaxkeyword">)<br />{<br /></span><span class="syntaxdefault">    echo</span><span class="syntaxstring">"Votre message a bien été envoyé"</span><span class="syntaxkeyword">;<br />}<br /></span><span class="syntaxdefault">        <br />    <br /></span><span class="syntaxkeyword">}</span><span class="syntaxdefault">else echo</span><span class="syntaxstring">"Vous devez saisir tous les champs pour pouvoir poster un commentaire"</span><span class="syntaxkeyword">;<br /><br />}<br /><br /><br /><br /></span><span class="syntaxdefault">?><br /></span><br /><form method="POST" action=livre.php><br /><hr><br /><strong>Poster un commentaire</strong><br /><p>Votre nom:</p><br /><input type="text" name="nom"><br /><p> Votre email:</p><br /><input type="text" name="email"><br /><p>Votre message</p><br /><textarea name="message" ros="6" cols="35"></textarea><br/><br/><br /><input type="submit" name="submit" value="poster"><br /></form><br /></span>

Erreur :


Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Can't connect to local MySQL server through socket '/tmp/mysqld.sock' (2) in /homepages/25/d428768758/htdocs/dsc070103546/MERDE.PHP on line 6

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /homepages/25/d428768758/htdocs/dsc070103546/MERDE.PHP on line 6

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Can't connect to local MySQL server through socket '/tmp/mysqld.sock' (2) in /homepages/25/d428768758/htdocs/dsc070103546/MERDE.PHP on line 7

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /homepages/25/d428768758/htdocs/dsc070103546/MERDE.PHP on line 7

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Can't connect to local MySQL server through socket '/tmp/mysqld.sock' (2) in /homepages/25/d428768758/htdocs/dsc070103546/MERDE.PHP on line 8

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /homepages/25/d428768758/htdocs/dsc070103546/MERDE.PHP on line 8

Warning: mysql_select_db() [function.mysql-select-db]: Can't connect to local MySQL server through socket '/tmp/mysqld.sock' (2) in /homepages/25/d428768758/htdocs/dsc070103546/MERDE.PHP on line 21

Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /homepages/25/d428768758/htdocs/dsc070103546/MERDE.PHP on line 21

Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/tmp/mysqld.sock' (2) in /homepages/25/d428768758/htdocs/dsc070103546/MERDE.PHP on line 23

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /homepages/25/d428768758/htdocs/dsc070103546/MERDE.PHP on line 23
 
WRInaute accro
Tu nous montres livre.php alors que le problème se produit dans MERDE.PHP :mrgreen:
Là on dirait que c'est tout simplement le serveur MySQL qui est down.
 
Nouveau WRInaute
hahaha oui j'ai oublié de changer MERDE.php xD au temps pour moi lol.

Bon en fait ce sont les mêmes erreurs mais avec livre.php ^^.

Tu penses que ca vient de mysql?

Car j'ai crée ma bdd sous phpmyadmin, (depuis l'espace client de 1AND1). Donc ca semblerait bizard :/
 
WRInaute discret
Peut-être je suis complètement à coté de la plaque mais chez 1and1 j'avais un serveur de base de base de donnée avec un nom complètement différent. C'était plutôt un truc du genre :

Code:
$connect = mysql_connect('db650.1and1.fr','dboXXXXXXX','MONMOTDEPASSE');

Peut-être va vérifier le nom du serveur de la base de donnée dans ton panel d'administration.
 
Discussions similaires
Haut