GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Is there are script that can do this? (https://gfy.com/showthread.php?t=720647)

m0307 04-02-2007 11:00 PM

Is there are script that can do this?
 
I have currently been developing a website that requires an enormous amount of data to by inputed into a data base. I am currently manually exporting data from a notepad document into my database. This is taking up way too much time having to type everything.

Is there a script out there that can export data from a notepad document into the websites database. My website is written in php. If there isn't a script that does this, is there anyone who could make one?:thumbsup

m0307 04-02-2007 11:29 PM

Quote:

Originally Posted by m0307 (Post 12186195)
I have currently been developing a website that requires an enormous amount of data to by inputed into a data base. I am currently manually exporting data from a notepad document into my database. This is taking up way too much time having to type everything.

Is there a script out there that can export data from a notepad document into the websites database. My website is written in php. If there isn't a script that does this, is there anyone who could make one?:thumbsup


bump....is phpmyadmin the best way to go?

spacedog 04-02-2007 11:31 PM

There's a way, yes.. I'm not sure on the specifics, but if you ftp the notepad .txt to your server, you can via phpmyadmin import it into tables

GrouchyAdmin 04-03-2007 12:14 AM

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 04-03-2007 12:18 AM

To append to the above (edit timer ran out): I could likely make what you need if you could tell me what you want, or offered a dbschema (what you're dumping, where). Depending on complexibility, most of the work is already done above.

darksoul 04-03-2007 12:24 AM

Quote:

Originally Posted by GrouchyAdmin (Post 12186415)
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:
...obviously, parsing it and doing the mysql_insert in the loop is up to you. ;)

You don't need a script to import a csv file.

GrouchyAdmin 04-03-2007 01:22 AM

Quote:

Originally Posted by darksoul (Post 12186450)
You don't need a script to import a csv file.

You have console access.. and most users don't have the ability to turn on load file support, assuming, of course, this is applicable. However, yes, if you're doing CSV, phpMyAdmin would be the easy choice. ;)


All times are GMT -7. The time now is 02:04 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123