Location: PHPKode > projects > Esp php p2p project > p2p/table2csvdumpcreation.php
<?PHP
$sqlhostname = "127.0.0.1";
$login = "nellainet";
$password = "1234";
$base = "p2p";

$db_connect = mysql_connect($sqlhostname,$login,$password);
$base_selection = mysql_select_db($base,$db_connect);
$query =  "SELECT * FROM fs";
$req = mysql_query($query);
$res = mysql_num_rows($req);
$filecontent="";
while($row = mysql_fetch_array($req))
            {
               $path =$row['path'];
               $filename=$row['filename'];
               $filesize=$row['filesize'];
               $filectime=$row['filectime'];
               $filemtime=$row['filemtime'];
//echo "$path,$filename,$filesize,$filectime,$filemtime\n";
$filecontent.="$path,$filename,$filesize,$filectime,$filemtime\n";
    }

//$filecontent=addslashes($filecontent);
$filename="dump.csv";
$fp = fopen("$filename", "wb");
//flock($fp, 1);
fwrite ($fp, $filecontent);
//flock($fp, 3);
fclose($fp);

mysql_free_result($req);


 
?>
Return current item: Esp php p2p project