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 '<div align="justify" style="position:relative; overflow:hidden; width:170px; height:120px;">
43 <span id="defileH1"
44 style="position:absolute; width:170px; height:120px; background-color:#FF0000;"
45 onMouseover="defileH_1.delta=0"
46 onMouseout="defileH_1.delta=deltaH1">';
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 '<font style="color:#FFFFFF; font-size:10px; font-family:Verdana, Arial, Helvetica, sans-serif;"><b>'.stripslashes($tab1[1]).'</b></font><br>
53 <font style="color:#FFFFFF; font-size:10px; font-family:Verdana, Arial, Helvetica, sans-serif;">'.stripslashes($tab1[2]).'</font><br><br>';
54 }
55 echo '</span></div>';
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