View Single Post
Old 04-03-2007, 12:14 AM  
GrouchyAdmin
Now choke yourself!
 
GrouchyAdmin's Avatar
 
Industry Role:
Join Date: Apr 2006
Posts: 12,085
Depends on the format. If it's native SQL, or hand-edited CSV, sure, that's easy.

If you just want to dump a whole blob into a table, it's easiest to do with a throwaway PHP script:
Code:
<?php
mysql_connect($host, $user, $pass) or die("Can't connect to database.");
mysql_select_db($dbname) or die("Can't select database.");
$data=(is_file($filename) && is_readable($filename)) ? file_get_contents($filename) : die("Missing file.");
// ... parse file ...  Let's assume you used a pipe as a delimiter, and data is good
$data = explode("|", $data);
while (list($key, $value, $...) = each($data)) {
    echo "Key: $key; Value: $value<br />\n";
}
?>
...obviously, parsing it and doing the mysql_insert in the loop is up to you. ;)
__________________
GrouchyAdmin is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote