Is there any php/mysql software that can pull data from a mysql database or a csv file, and allow you to edit, perhaps copy/paste new rows, then save this file as a csv?
是否有任何php / mysql软件可以从mysql数据库或csv文件中提取数据,并允许你编辑,也许复制/粘贴新行,然后将此文件保存为csv?
needs to be web based. any pointers will help.
需要基于网络。任何指针都会有所帮助。
1 个解决方案
#1
Are the fgetcsv (http://us3.php.net/manual/en/function.fgetcsv.php) and fputcsv (http://us3.php.net/manual/en/function.fputcsv.php) functions sufficient?
fgetcsv(http://us3.php.net/manual/en/function.fgetcsv.php)和fputcsv(http://us3.php.net/manual/en/function.fputcsv.php)功能是否足够?
In terms of fetching data from a mysql database:
在从mysql数据库中获取数据方面:
$result = mysql_query($some_query);
$file = fopen('some_file', 'w');
$is_first = true;
while($row = mysql_fetch_assoc($result)) {
if($is_first) {
fputcsv($file, array_keys($row));
$is_first = false;
}
fputcsv($file, $row);
}
fclose($file);
Haven't tested it, but that will probably work to convert a mysql query result into a csv file, including the column names at the top of the file.
尚未测试过,但这可能会将mysql查询结果转换为csv文件,包括文件顶部的列名。
#1
Are the fgetcsv (http://us3.php.net/manual/en/function.fgetcsv.php) and fputcsv (http://us3.php.net/manual/en/function.fputcsv.php) functions sufficient?
fgetcsv(http://us3.php.net/manual/en/function.fgetcsv.php)和fputcsv(http://us3.php.net/manual/en/function.fputcsv.php)功能是否足够?
In terms of fetching data from a mysql database:
在从mysql数据库中获取数据方面:
$result = mysql_query($some_query);
$file = fopen('some_file', 'w');
$is_first = true;
while($row = mysql_fetch_assoc($result)) {
if($is_first) {
fputcsv($file, array_keys($row));
$is_first = false;
}
fputcsv($file, $row);
}
fclose($file);
Haven't tested it, but that will probably work to convert a mysql query result into a csv file, including the column names at the top of the file.
尚未测试过,但这可能会将mysql查询结果转换为csv文件,包括文件顶部的列名。