par
dunbar » 28 mai 2007, 21:29
Bonjour,
Je créer un fichier txt à partir des données de ma page et il se passe un truc bizarre mon code
<?php
include "data/config.php";
print_r($_GET);
//****************************************
//** Connexion à la base de données **
//****************************************
//Connexion à la base de données
$connection = mysql_connect( DB_HOST, DB_LOGIN, DB_PASS)
or die("Erreur MySQL : impossible de se connecter au serveur de données");
//Sélection de la base de données
mysql_select_db(DB_BASE)
or die("Erreur MySQL : impossible de se connecter à la base de données '".DB_BASE."'");
//****************************************
//****Récupération de la video via sont id******/////
$video_detail= (isset($_GET['id_video'])) ? " WHERE id_video = '".$_GET['id_video']."'" : "";
//****Requete*****/
$sql = "SELECT * FROM movie ".$video_detail;
$result = mysql_query($sql) or die ('Erreur de liens : '.mysql_error());
$total = mysql_num_rows($result);
$row = mysql_fetch_array($result);
//*****Affichage des résultats de la requete *******///
if($total) {
echo '<pre>';
print_r($row) ;
echo'</pre>';
//****Creation du fichier .TXT********////
if ( ! empty($row) ) {
$txt = 'Auteur='.$auteur."\r\n";
$txt .= 'flv='.$row['adr_video']."\r\n";
$txt .= 'title='.$row['titre']."\r\n";
$txt .= 'width='.$width."\r\n";
$txt .= 'height='.$height. "\r\n";
$txt .= 'playercolor='.$playercolor."\r\n";
$txt .= 'bgcolor1='.$bgcolor1."\r\n";
$txt .= 'bgcolor2='.$bgcolor2."\r\n";
$txt .= 'buttoncolor='.$buttoncolor."\r\n";
$txt .= 'buttonovercolor='.$buttonovercolor."\r\n";
$txt .= 'slidercolor1='.$slidercolor1."\r\n";
$txt .= 'slidercolor2='.$slidercolor2."\r\n";
$txt .= 'sliderovercolor='.$sliderovercolor."\r\n";
$txt .= 'loadingcolor='.$loadingcolor."\r\n";
$txt .= 'showstop='.$showstop."\r\n";
$txt .= 'showvolume='.$showvolume."\r\n";
$txt .= 'showtime='.$showtime."\r\n";
$txt .= 'showfullscreen='.$showfullscreen ."\r\n";
$txt .= 'showswitchsubtitles='.$showswitchsubtitles."\r\n";
$txt .= 'srt='.$srt."\r\n";
file_put_contents('flv_config_maxi.txt', $txt) ; //****creation du fichier .txt*****//
}
//*****Fin de création du .TXT**************//
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Video de dunbar</title>
</head>
<body>
<table summary="Des vidéos de dunbar" width="35%">
<thead>
</thead>
<tfoot>
</tfoot>
<tr>
<td>
<object type="application/x-shockwave-flash" data="player_flv_maxi.swf" width="320" height="240">
<param name="movie" value="player_flv_maxi.swf" />
<param name="allowFullScreen" value="true" />
<param name="FlashVars" value="config=flv_config_maxi.txt" />
<p>Problème chargement du fichier</p>
</object>
</td>
</tr>
</table>
</body>
</html>
<?php
?>
Il récupére bien la bonne id, mon print_r ($row) correspond à la bonne id mais ce

de php m'écrit mon fichier .txt avec la première entrée de ma TABLE alors ma question pourquoi
D'avance merci

Bonjour,
Je créer un fichier txt à partir des données de ma page et il se passe un truc bizarre mon code
[php]
<?php
include "data/config.php";
print_r($_GET);
//****************************************
//** Connexion à la base de données **
//****************************************
//Connexion à la base de données
$connection = mysql_connect( DB_HOST, DB_LOGIN, DB_PASS)
or die("Erreur MySQL : impossible de se connecter au serveur de données");
//Sélection de la base de données
mysql_select_db(DB_BASE)
or die("Erreur MySQL : impossible de se connecter à la base de données '".DB_BASE."'");
//****************************************
//****Récupération de la video via sont id******/////
$video_detail= (isset($_GET['id_video'])) ? " WHERE id_video = '".$_GET['id_video']."'" : "";
//****Requete*****/
$sql = "SELECT * FROM movie ".$video_detail;
$result = mysql_query($sql) or die ('Erreur de liens : '.mysql_error());
$total = mysql_num_rows($result);
$row = mysql_fetch_array($result);
//*****Affichage des résultats de la requete *******///
if($total) {
echo '<pre>';
print_r($row) ;
echo'</pre>';
//****Creation du fichier .TXT********////
if ( ! empty($row) ) {
$txt = 'Auteur='.$auteur."\r\n";
$txt .= 'flv='.$row['adr_video']."\r\n";
$txt .= 'title='.$row['titre']."\r\n";
$txt .= 'width='.$width."\r\n";
$txt .= 'height='.$height. "\r\n";
$txt .= 'playercolor='.$playercolor."\r\n";
$txt .= 'bgcolor1='.$bgcolor1."\r\n";
$txt .= 'bgcolor2='.$bgcolor2."\r\n";
$txt .= 'buttoncolor='.$buttoncolor."\r\n";
$txt .= 'buttonovercolor='.$buttonovercolor."\r\n";
$txt .= 'slidercolor1='.$slidercolor1."\r\n";
$txt .= 'slidercolor2='.$slidercolor2."\r\n";
$txt .= 'sliderovercolor='.$sliderovercolor."\r\n";
$txt .= 'loadingcolor='.$loadingcolor."\r\n";
$txt .= 'showstop='.$showstop."\r\n";
$txt .= 'showvolume='.$showvolume."\r\n";
$txt .= 'showtime='.$showtime."\r\n";
$txt .= 'showfullscreen='.$showfullscreen ."\r\n";
$txt .= 'showswitchsubtitles='.$showswitchsubtitles."\r\n";
$txt .= 'srt='.$srt."\r\n";
file_put_contents('flv_config_maxi.txt', $txt) ; //****creation du fichier .txt*****//
}
//*****Fin de création du .TXT**************//
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Video de dunbar</title>
</head>
<body>
<table summary="Des vidéos de dunbar" width="35%">
<thead>
</thead>
<tfoot>
</tfoot>
<tr>
<td>
<object type="application/x-shockwave-flash" data="player_flv_maxi.swf" width="320" height="240">
<param name="movie" value="player_flv_maxi.swf" />
<param name="allowFullScreen" value="true" />
<param name="FlashVars" value="config=flv_config_maxi.txt" />
<p>Problème chargement du fichier</p>
</object>
</td>
</tr>
</table>
</body>
</html>
<?php
?>[/php]
Il récupére bien la bonne id, mon print_r ($row) correspond à la bonne id mais ce :tir2: de php m'écrit mon fichier .txt avec la première entrée de ma TABLE alors ma question pourquoi :?:
D'avance merci :wink: