Topics

User Functions

Events

There are no upcoming events

What's New

Stories

No new stories

Comments last 2 weeks


Trackbacks last 2 weeks

No new trackback comments

Links last 2 weeks

No recent new links

NEW FILES last 14 days

No new files

Welcome to Geeklog Thursday, June 20 2013 @ 06:25 AM EDT


 Forum Index > Support > Installation Support New Topic Post Reply
 Useful tool - CSV to MySQL
First | Previous | 1 2 | Next | Last
   
Anonymous: droc
 12/16/10 07:15PM  



http://csv2sql.com/

 
 Quote
Anonymous: Agilefuse Consulting
 12/22/10 08:03AM  

angelic


http://www.agilefuseconsulting.co.cc/development/csvtomysql/

this is my tool. i developed the tool using html5 and file api. please take note that this only works on firefox and google chrome browser(latest version). also large data to import requires large time to complete, and also may cause memory limit error. so please use the tool with care. thanks.

 
 Quote
Anonymous: alexpran
 01/08/11 05:24PM  



seems most online tools have been taken down or dont work, but found I found this basic (and free) site convertcsvtomysql.com

seems limited but was enough for my needs, i think its still in dvelopment too

 
 Quote
Anonymous: thiyagi
 02/15/11 07:49AM  



thanks man..

 
 Quote
Anonymous: Erel Segal Halevi
 05/09/11 08:37AM  



Here is a PHP function that does the trick:
PHP Formatted Code

function csv_file_to_mysql_table($source_file, $target_table, $max_line_length=10000) {
        if (($handle = fopen("$source_file", "r")) !== FALSE) {
                $columns = fgetcsv($handle, $max_line_length, ",");
                foreach ($columns as &$column) {
                        $column = str_replace(".","",$column);
                }
                $insert_query_prefix = "INSERT INTO $target_table (".join(",",$columns).")\nVALUES";
                while (($data = fgetcsv($handle, $max_line_length, ",")) !== FALSE) {
                        while (count($data)<count($columns))
                                array_push($data, NULL);
                        $query = "$insert_query_prefix (".join(",",quote_all_array($data)).");";
                        mysql_query($query);
                }
                fclose($handle);
        }
}
 

 
 Quote
Anonymous: sewerewes
 08/04/11 04:00PM  



This function won't work unless you've got your own function for quote_all_array() - that isn't a built-in PHP function. This works pretty well:
PHP Formatted Code

function quote_all_array($arr)
{
        foreach ($arr as $k=>$v)
        {
               
                $returnArr[$k] = ($v) ? '"'.str_replace('"','\"',$v).'"' : "NULL" ;
        }      
        return $returnArr;
}
 

 
 Quote
MyJuliet
 08/23/11 03:10AM  
+----
Newbie

Status: offline


Registered: 08/23/11
Posts: 1
Please give me the correct link to your article, so I can use it. I have the same problem.

 
Profile Email
 Quote
Anonymous: Andreas Herz
 09/01/11 01:30AM  



Hi,

maybe the phpBlocks lib can solve the export/inport of CSV files in a more
smart way like Googles AppInventor. You can change the export format in an
Click&Point manner. Like Google AppInventor or the programming IDE Scratch
from the MIT.

phpBlocks is GPL and can be downloaded from the WebSite. Worth a look for dyn.
PHP formular and exports.

Common Demos: http://www.freegroup.de/software/phpBlocks/demo.html
Link to example: http://www.freegroup.de/test/editor/editor.php?xml=demo_sql.xml

Greetings

Andreas


 
 Quote
Anonymous: Anonymous Geek
 05/18/12 01:52PM  



For anyone wondering what was on the original mysqlDBU site... here it is in the internet archive

http://web.archive.org/web/20100912102607/http://www.sqldbu.com/eng/sections/tips/mysqlimport.html


it was a web-based solution Rolling Eyes

 
 Quote
Anonymous: Richard
 08/08/12 04:12AM  



If you would like to pre-validate and rollback on errror - you might like check out this post/tip on CSV import from Excel to MySQL

http://leansoftware.net/tabid/123/g/posts/t/17/How-to-validate-and-upload-CSV--comma-seperated-value--data-to-a-database.aspx

Could save you some time - this is a professional tool - free for 60 days

 
 Quote
First | Previous | 1 2 | Next | Last
Content generated in: 0.62 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Able to post 
Filtered HTML Allowed 
Censored Content