salut tout le monde!
voila, une personne que je connais m' a fait un petit script pour un site qui référence les films sortis dans les salles; avec pour chacun la bande annonce a télécharger.
ce "script" fonctionne avec mysql.
donc j' ai un fichier affichage.php et un fichier statistique.php
et le fichier statistique.php
bon dsl je sais que ca fait gros ces 2 fichiers sur une page !
alors le truc que je veux, c' est avoir les statistiques a coté de chaque films;
donc ce que j' ai fait, c' est que j' ai mis le header de la page statistique dans celui de la page affichage.php ; et k ai pris tous les codes php que j' ai mis a coté du film;
et ca marche pas, erreur, j' ai essayé plein d astuces, rien n'y fait
alors aidez moi svp!! je suis pas très balèze niveau php
voila, une personne que je connais m' a fait un petit script pour un site qui référence les films sortis dans les salles; avec pour chacun la bande annonce a télécharger.
ce "script" fonctionne avec mysql.
donc j' ai un fichier affichage.php et un fichier statistique.php
Code:
affichage.php :
<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
<?php require("param.php"); ?>
<?php if(!isset($limit)){
$limit=0;
}
if(!isset($number)){
$number=10;
}
?>
<?php
require("param.php");
if($link=mySql_connect($hote,$identifiant,$mot_de_passe)){
if(mySql_select_db($nom_db,$link)){
$query = "SELECT * FROM film LEFT JOIN statistique ON film.id =statistique.id";
if($result= mySql_query($query,$link)){
?>
<?php
$count=0;
if($link=mySql_connect($hote,$identifiant,$mot_de_passe)){
if(mySql_select_db($nom_db,$link)){
$query = "SELECT * FROM film";
if($result= mySql_query($query,$link)){
while($ligne = mySql_fetch_object($result)){
$film[0]=$ligne->titre;
$film[1]=$ligne->description;
$film[2]=$ligne->image;
$film[3]=$ligne->torrent;
$film[4]=$ligne->edonkey;
$film[5]=$ligne->id;
$films[$count]= $film;
$count++;
}
}else{ echo "<h1>PB 3</h1>";}
}else{ echo "<h1>PB 2</h1>";}
}else{ echo "<h1>PB 1</h1>";}
?>
<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
<html>
<head>
<title>Document sans titre</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p>
<?php
if($limit+$number <= count($films)){
$max=$limit+$number;
}else{$max=count($films);}
if($limit <= 0){
$limit=0;
$visible_precedent=false;
}else{$visible_precedent=true;}
$limit_suivant=$limit+$number;
$limit_precedent=$limit-$number;
if($limit >= count($films)){$visible_suivant=false;}else{$visible_suivant=true;}
for($i=$limit;$i < $max;$i++){
$filmi=$films[$i];
?>
</p>
<table width="99%" border="0" cellspacing="0">
<tr>
<td><div align="center"><font color="#CCCCCC"><em>Format : <br>
<?php echo "$filmi[4]"; ?> </em></font></div></td>
<td><div align="center"><font color="#CCCCCC"><?php echo "<a href=\"./download.php?id=$filmi[5]\">"; ?><?php echo "$filmi[0]"; ?></font></div></td>
</tr>
<tr>
<td width="18%"><div align="center"><font color="#FFFFFF"><em><?php echo "<img src=\"http://lurldelimage/$filmi[2]\" width=\"120\" height=\"160\">" ;?></em></font></div></td>
<td width="82%"><p align="justify"><font color="#FFFFFF" size="2"><?php echo $filmi[1]; ?></font><br>
<strong></strong><font color="#FFFFFF"><strong><br>
</strong><?php echo "<a href=\"./download.php?id=$filmi[5]\">"; ?><em>T&l&charger
la bande annonce</em><em><font size="2"><br>
<br>
</font></em></font></p></td>
</tr>
<tr>
<td bgcolor="#000033">&</td>
<td bgcolor="#000033">&</td>
</tr>
</table>
<p>
<?php }?>
<?php
}else{echo "pb2";}
}else{echo "pb3";}
}else{echo "pb4";}
?>
</p>
<table width="98%" border="0">
<tr>
<td width="32%" height="114"> <div align="center"><a href="index.php?limit=<?php echo $limit_precedent; ?>&number=<?php echo $number; ?>">
<?php if($visible_precedent){?>
Page pr&c&dente</a>
<?php }?>
</div></td>
<td width="45%"> <form name="form2" id="form2" method="post" action="">
<div align="center"><font color="#FFFFFF"><strong>Nombre de films par pages
: </strong></font>
<select name="select" size="1" onChange="location.href='index.php?number='+(this[this.selectedIndex].value);">
<option >choisir</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="10">10</option>
<option value="15">15</option>
<option value="20">20</option>
</select>
</div>
</form></td>
<td width="23%"> <p align="center"><a href="index.php?limit=<?php echo $limit_suivant; ?>&number=<?php echo $number; ?>">
<?php if($visible_suivant){?>
Page suivante </a>
<?php }?>
</p></td>
</tr>
</table>
<p></p>
</body>
</html>
et le fichier statistique.php
Code:
?php
require("param.php");
if($link=mySql_connect($hote,$identifiant,$mot_de_passe)){
if(mySql_select_db($nom_db,$link)){
$query = "SELECT * FROM film LEFT JOIN statistique ON film.id =statistique.id";
if($result= mySql_query($query,$link)){
?>
<html>
<head>
<title>Statistique</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body text="#FFFFFF">
<p>&</p>
<table width="115%" border="0">
<?php while($ligne = mySql_fetch_object($result)){?>
<tr>
<td width="10%">&</td>
<td width="90%"><font color="#000000"><?php echo $ligne->titre; ?> a &t&
t&l&charg& <?php echo $ligne->nombre_telechar; ?> fois.</font></td>
</tr>
<?php }?>
</table>
<?php
}else{echo "pb2";}
}else{echo "pb3";}
}else{echo "pb4";}
?>
</body>
</html>
bon dsl je sais que ca fait gros ces 2 fichiers sur une page !
alors le truc que je veux, c' est avoir les statistiques a coté de chaque films;
donc ce que j' ai fait, c' est que j' ai mis le header de la page statistique dans celui de la page affichage.php ; et k ai pris tous les codes php que j' ai mis a coté du film;
et ca marche pas, erreur, j' ai essayé plein d astuces, rien n'y fait
alors aidez moi svp!! je suis pas très balèze niveau php