View file catalog/1.php

File size: 607B
<?
include "confdb.php";
$dbc =@mysql_connect($db_host, $db_user, $db_pass); 
$dbs = mysql_select_db($db_name);
$query='select * from `cat_catalog`';
$result=mysql_query($query);
$col=mysql_num_rows($result);
$catfile = "cats.txt";
$catfile = fopen($catfile, "a");// or die("File ($file) does not exist!");
//$str=$cat."|".$name."|".$addr."|1"."\r\n";
//fputs($catfile,$str);


for ($i=0; $i<$col; $i++)
{
GLOBAL $result;
$data=mysql_fetch_array($result);
$str=$data["id"]."|".$data["cat"]."|".$data["name"]."|".$data["address"]."|1"."\r\n";
fputs($catfile,$str);
}
fclose($catfile);
?>