Bonsoir,
Je suis un tuto pour réaliser un mini-moteur de recherche ici, avec des stars. J'ai cette erreur qui s'affiche lorsque je tape une lettre dans le champs.
erreur:Voici les fichiers :Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /home/testdrup/www/Recherche/post.php on line 6
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/testdrup/www/Recherche/post.php on line 6
Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /home/testdrup/www/Recherche/post.php on line 8
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/testdrup/www/Recherche/post.php on line 8
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
post.phpconnect.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 <?php include('connect.php'); if(isset($_POST['search'])&&!empty($_POST['search'])) { $search = mysql_real_escape_string(htmlentities($_POST['search'])); $query = mysql_query("SELECT nom_star FROM stars WHERE nom_star LIKE '$search%'''") or die(mysql_error()); while($rows = mysql_fetch_assoc($query)) { echo"<li><a href='#'>".$rows['nom_star']."</a></li>"; } } ?>MERCI.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 <?php $db_host = 'test.mysql.db'; $db_name = 'testl'; $db_user = 'test; $db_pass = 'Mdp'; try { $bdd = new PDO('mysql:dbname='.$db_name.';host='.$db_host, $db_user, $db_pass); $bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch(Exception $e) { die('Erreur : '.$e->getMessage()); } ?>
Partager