Bonjours à tous.
Je vous demande de l'aide afin de m'aider dans le problème suivant :
J'ai mis en place un systeme de "publication" sur une page , combiné avec Ajax et Jquery pour une actualisation auto.
Ceci se fait par l'intermédiaire d'une boucle while.
Le probleme, c'est que 2 erreurs apparaissent lors du rafraîchissement avec ajax :
"
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/host/playz.kappatau.fr/public_html/userfeed.php on line 41
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/host/playz.kappatau.fr/public_html/userfeed.php on line 66"
Voici la page entiere :
J'ai beau essayer tout et n'importe quoi, soit j'ai ces erreurs , soit il y a un nombre infini de publications (avec comme date 01/01/1970 00:00:00)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108 <?php include('config.php'); ?> <style> #feedobjects { Background-Color: #3F3F3F; border-radius: 10px; opacity:0.8; } #feedobjects:hover { background-color: #333333; } #post { Background-Color: #935C97; border-radius: 10px; } </style> <?php $ddb = mysql_query('select * from user_feed WHERE USERID='. $dnn['id'] .' ORDER BY create_date DESC LIMIT 0, 6'); if($_SESSION['userid']==$id) { ?> <div id="post"> <table cellspacing="2" cellpadding="0" border="0"> <tr> <td> <img src="<?php echo htmlspecialchars($dnn['avatar']); ?>" style="width:50px; height:50px;"> </td> <td> <form method="POST" action="profil?id=<?php echo $_SESSION['userid']; ?>"> <input type="text" name="publication" value=" Faites une annonce..." onFocus="this.value=''" onmouseOver="this.value=''"> <input type="submit" value="Publier" class="button"> </form> </td> </tr> </table></div><br> <?php } $objectnbr=1; while($db = mysql_fetch_array($ddb)) { ?> <div id="feedobjects"> <table cellspacing="2" cellpadding="0" border="0" width="250" style="" > <tr> <td width="50" rowspan="2"> <img src="<?php echo htmlspecialchars($dnn['avatar']); ?>" style="width:50px; height:50px;"><br> </td> <td align="left"> <?php echo $db['data']; ?> </td> </tr> <tr> <td> <FONT size="1pt" color="#818281"><?php echo date('d/m/Y H:i:s' ,$db['create_date']); ?></font> </td> <td align="right"> <div id="deletebutton"><img src="image/delete.png" style="width:10px;"></div><?php echo $objectnbr; ?> </td> </tr> </table> </div> <br> <?php $objectnbr++; } if(intval(mysql_num_rows($ddb))==0) { ?> <center>Rien à signaler...</center> <?php } ?> <?php //On verifie que le formulaire a ete envoye if(isset($_POST['publication']) ) { //On enleve lechappement si get_magic_quotes_gpc est active if(get_magic_quotes_gpc()) { $_POST['publication'] = stripslashes($_POST['publication']); } //On verifie si la publication a 100 caracteres ou plus if(strlen($_POST['publication'])<400) { //On echape les variables pour pouvoir les mettre dans une requette SQL $data = mysql_real_escape_string($_POST['publication']); $userid = mysql_real_escape_string($_SESSION['userid']); $type = mysql_real_escape_string(announcement); $dn2 = mysql_num_rows(mysql_query('select id from user_feed')); $id = $dn2+1; //On enregistre les informations dans la base de donnee if(mysql_query('insert into user_feed(id, userid, type, data, create_date) values ('.$id.', "'.$userid.'", "'.$type.'", "'.$data.'", "'.time().'")')) { } } } ?> <!-- FONCTION --> <script> </script> <!--FIN FONCTION -->
Pouvez-vous m'aider, ou du moins m’éclaircir ? =)
Merci d'avance.
Partager