Bonjour, je sollicite de l'aide car je bloque. J'essaie de faire un blog suivant tuto, ça marche en interne sous Wampserver mais lorsque je veux mettre en ligne rien ne s'affiche hors le background. ni le script jquery.js qui est dans le même dossier ni le script http://www.google.com/jsap ne donne de résultat. ou est l'erreur?
ci-après le fichier:index
le ficihier fonction
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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49 <?php include('function.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>BLOG</title> <link rel="stylesheet" href="style.css" type="text/css" /> <style> form { display:none; } .loader { display:none; } </style> </head> <body background="image/abIhh2.jpg"> <?php $articles = recup_article(); foreach($articles as $article) { echo"<h2><a href='post_article.php'>".$article['titre_article']."</a></h2> <H4>Posté par: ".$article['membre_article']." le ".$article['date_article']."<br/></H4> <h3><p>**".$article['corps_article']."**<a href='#' id=".$article['id_article'].">(".($article['totales_commentaires']==NULL?0:$article['totales_commentaires']).")commentaire(s)</a>, dernier commentaire posté le ".($article['dernier_commentaire']==NULL?'(Aucun commentaire trouvé)':$article['dernier_commentaire'])."<hr/></p></h3>" ; ?> <div id="loader<?php echo $article['id_article']?>" class="loader"> <img src="image/loader.gif" alt="loader"/> </div> <div id="feedback<?php echo $article['id_article'];?>"></div> <form method="post" action="" id="form<?php echo $article['id_article'];?>"> <p>Votre Nom:</p> <input type="text" id="membre_commentaire"/> <p>Votre commentaire</p> <textarea rows="4" cols="20" id="corps_commentaire"/></textarea><br /><br /> <input type="submit" value="Poster" id="submit"/> </form> <?php } ?> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script src="func.js"></script> </body> </html>
et li fichier func.js
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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59 <?php header('Content-Type:text/html; charset=utf-8'); ?> <?php $host="mysql.bemils.be";//Host name $username="claude"; //Mysql username $password="cs432621"; //Mysql password $db_name="bemilsbe3"; //Database name //$tbl_name="articles"; //Table name mysql_connect("$host","$username","$password") or die("Cannot connect"); //mysql_connect('localhost','root') mysql_query("SET NAMES 'utf8'"); mysql_select_db("$db_name") or die("Cannot select Data Base "); function ajouter_article($titre_article, $membre_article, $corps_article) { $query = mysql_query("INSERT INTO articles(titre_article,membre_article,corps_article,date_article) VALUES('$titre_article','$membre_article','$corps_article',NOW())"); } function recup_article() { $articles = array(); $result = mysql_query("SELECT articles.id_article, titre_article, membre_article, corps_article, DATE_FORMAT(articles.date_article,'%d/%m/%Y %H:%i:%S')AS date_article, commentaires.totales_commentaires, DATE_FORMAT(commentaires.dernier_commentaire,'%d/%m/%Y %H:%i:%S')AS dernier_commentaire FROM articles LEFT JOIN (SELECT id_article,COUNT(id_commentaire) AS totales_commentaires, MAX(date_commentaire) AS dernier_commentaire FROM commentaires GROUP BY id_article ) AS commentaires ON articles.id_article=commentaires.id_article") or die(mysql_error()); while($row=mysql_fetch_assoc($result)) { $articles[] = $row; } return $articles; } function inserer_commentaire($id,$membre_commentaire,$corps_commentaire) { mysql_query("INSERT INTO commentaires(id_article,membre_commentaire,corps_commentaire, date_commentaire) VALUES('$id','".mysql_real_escape_string ($membre_commentaire)."','".mysql_real_escape_string ($corps_commentaire)."',NOW())"); } function recup_commentaires($id) { $id = (int)$id; $commentaires = array(); $sql = mysql_query("SELECT membre_commentaire, corps_commentaire, DATE_FORMAT(date_commentaire,'%d/%m/%Y %H:%i:%S') AS date_commentaire FROM commentaires WHERE id_article='$id' ORDER BY id_commentaire DESC ") or die (mysql_error()); while($row = mysql_fetch_assoc($sql)) { $commentaires[] = $row; } return $commentaires; } ?>
D'avance merci pour l'aide
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
21
22
23
24
25
26
27
28
29
30
31
32 $('a').click(function(){ var id = $(this).attr('id'); $('#loader'+id).show(); $.post('afficher_commentaire.php',{id:id},function(data){ $('#feedback'+id).html(data); //afficher formulaire $('#form'+id).show(); $('#loader'+id).hide(); $('#form'+id).submit(function(){ var membre_commentaire=$('#membre_commentaire',this).val(); var corps_commentaire=$('#corps_commentaire',this).val(); $.post('post_commentaire.php',{ id:id, membre_commentaire:membre_commentaire, corps_commentaire:corps_commentaire },function(data){ $('#feedback'+id).html(date); }); $('#membre_commentaire',this).attr('value',''); $('#corps_commentaire',this).attr('value',''); return false; }); }); }); });
Partager