Bonjour,
je veux récupérer les enregistrements de ma BDD MySql et les enregistrer dans en local (sur mon lecteur z: )dans un fichier txt.

Mais voilà, j'ai un BUG!
Warning: fopen(z:/participant.txt) [function.fopen]: failed to open stream: No such file or directory in /home/montagna/public_html/_CYCLO_bdd-txt.php on line 16

Ci joint mon code, en espérant que vous y trouverez ce qui cloche

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
<?php
//////////////////////////////////////////////////////////////////////////////////////////////////
//                      LECTURE DANS LA BASE DE DONNEES                                         //
//////////////////////////////////////////////////////////////////////////////////////////////////
include("connexion.inc");
mysql_connect("$host","$user","$password");
mysql_select_db($database);
 
if(file_exists("z:/participant.txt"))
   {
unlink("z:/participant.txt");
$fichiertxt=fopen("z:/participant.txt","a");
   }
else
   {
$fichiertxt=fopen("z:/participant.txt","a");
}
 
$req="select * from participant";
$result=mysql_query($req);
$lignes=mysql_num_rows($result);
 
$i=0;
if($lignes==0){
	echo "<br><br><center>Il n'existe aucune inscription pour le moment!</center>";
 
}else{
	for ($i=0;$i<$lignes;$i++)
	{
	$enr=mysql_fetch_row($result);
 
	fputs($fichiertxt,$enr[0]."#".$enr[1]."#".$enr[2]."#".$enr[3]."#".$enr[4]."#".$enr[5]."#".$enr[6]."#".$enr[7]."#".$enr[8]."#".$enr[9]."#".$enr[10]."#".$enr[11]."#".$enr[12]."#".$enr[13]."#".$enr[14]."#".$enr[15]."\r\n");
 
	}
	fclose($fichiertxt);
	mysql_close();
}
?>


Merci de votre aide...