Re: Mysql export
| From: | Andrey Hristov | Date: | Fri, 19 Oct 2001 18:49:44 +0000 |
| Subject: | Re: Mysql export | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-71583@lists.php.net to get a copy of this message | ||
PhpMyAdmin (on http://www.phpwizard.net") has the
capability to export mysql
table ot CSV, then import the CSV or maybe this will help you too(on small
tables, otherwise the HTML code is big)
$dump='';
$separator=',';
$the_query="select * from $table;";
$res=mysql_query($the_query);
if ($res){
$num_rows=mysql_num_rows($res);
for (;$numrows>=0;$num_rows--){
$arr=mysq_fetch_assoc($res);
$line='';
foreach ($arr as $k => $v){
$line.=($v.$separator);
}
$line=substr($line,0,-strlen($separator));
$dump.=$line."\n";
}
}
if ($dump){
$fd=fopen("{$table}_dump.csv","w+");
frwite($fd,$dump);
fclose($fd);
echo "<pre>\n".$dump."\n</pre>";
}
Hope this helps.
--
Andrey Hristov
Web Developer
Icygen Corporation
BUILDING SOLUTIONS
http://www.icygen.com
On Friday 19 October 2001 06:33 am, you wrote:
> Please help me, how to export mysql table to the xls table ?
> Thanks for all
>
> Roman