Calendrier dynamique

Résolu
cs_tgr74 Messages postés 23 Date d'inscription jeudi 22 mars 2007 Statut Membre Dernière intervention 26 août 2009 - 24 août 2009 à 20:11
cs_tgr74 Messages postés 23 Date d'inscription jeudi 22 mars 2007 Statut Membre Dernière intervention 26 août 2009 - 26 août 2009 à 10:03
Salut à tous
j'ai besoin d'aide pour l'élaboration d'une news défilante.
Après recherche sur le site, je suis tombé sur ce script : news.php

1 <script type= "text/javascript">
2 function Defilant(id, pos_init, pos_min, pos_max, delta, direction) {
3 this.id = id;
4 this.element = document.getElementById(id);
5 this.pos_init = pos_init;
6 this.pos_min = pos_min;
7 this.pos_max = pos_max;
8 this.pos_current = pos_init;
9 this.delta = delta;
10 this.direction = direction;
11 }
12
13 Defilant.prototype.defile = function() {
14 if (!this.element) {
15 this.element = document.getElementById(this.id);
16 }
17 if (this.element) {
18 if(this.direction == "vertical"){
19 if(this.pos_current < (this.pos_min - this.element.offsetHeight) ){
20 this.pos_current = this.pos_init;
21 } else if (this.pos_current > this.pos_max ) {
22 this.pos_current = this.pos_init - this.element.offsetHeight;
23 } else {
24 this.pos_current += this.delta;
25 }
26 this.element.style.top = this.pos_current+"px";
27 } else if(this.direction == 'horizontal') {
28 if(this.pos_current < (this.pos_min - this.element.offsetWidth) ){
29 this.pos_current = this.pos_init;
30 } else if (this.pos_current > this.pos_max ) {
31 this.pos_current = this.pos_init - this.element.offsetWidth;
32 } else {
33 this.pos_current += this.delta;
34 }
35 this.element.style.left = this.pos_current+"px";
36 }
37 }
38 }
39 </script>
40
41 <?php
42 echo '

43 ';
47
48 include('connec.php');
49 $req1_exe = mysql_query( 'select * from news_abs order by id desc' );
50 for ($i=0;($tab1=mysql_fetch_array($req1_exe)) && ($i!=5); $i++)
51 {
52 echo ' '.stripslashes($tab1[1]).'

53 '.stripslashes($tab1[2]).'

';
54 }
55 echo '
';
56 ?>
57
58 <script type ="text/javascript">
59 var deltaH1 = -1;
60 var defileH_1 = new Defilant("defileH1", 130, 0, 130, deltaH1,"vertical");
61 setInterval("defileH_1.defile()",40);
62 </script>

Mon problème est le suivant :
j'ai cette erreur Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\Task_force\news.php on line 52

Voici la ligne 52 : for ($i=0;($tab1=mysql_fetch_array($req1_exe)) && ($i!=5); $i++)

je suis novice en php

SVP aidez-moi

Tgr74

2 réponses

nautilus99 Messages postés 661 Date d'inscription vendredi 26 septembre 2008 Statut Membre Dernière intervention 18 septembre 2009 1
25 août 2009 à 21:12
Bonsoir:
le message
arning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in

indique que la requête n'a pas renvoyé une resource correcte.. Donc en utilisant mysql_error() tu devrais arriver à comprendre pourquoi.
3
cs_tgr74 Messages postés 23 Date d'inscription jeudi 22 mars 2007 Statut Membre Dernière intervention 26 août 2009
26 août 2009 à 10:03
Bonjour,
Merci pour la promptitude et pour la réaction. Cause erreur trouvée.

Tgr74
3
Rejoignez-nous