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)
-   -   PHP newbie question (https://gfy.com/showthread.php?t=474603)

fireorange 05-31-2005 05:47 AM

PHP newbie question
 
I'm searching for the code to batch import stuff into a MySQL db, can't find shit.

Example:

abc
zyx
qwe
asd

Each on a seperate line, from a HTML form submit.

Any help? :winkwink:

ddfGandalf 05-31-2005 06:03 AM

Dunno really what you need, but you could use $HTTP_POST_VARS or $HTTP_GET_VARS depending on your form action, then process the array (while) and simple INSERT into db?:)

Serge Litehead 05-31-2005 06:09 AM

batch import: http://sunsite.mff.cuni.cz/MIRRORS/f...atch_mode.html

the example is not clear in regards to mysql subject

MickeyG 05-31-2005 06:20 AM

if its a html submit use a loop, otherwise you can use a txt file and then import into mysql.

fireorange 05-31-2005 06:27 AM

Quote:

Originally Posted by MickeyG
if its a html submit use a loop, otherwise you can use a txt file and then import into mysql.

Yea that's what I want but I can't find any sample code on Google to use.

psili 05-31-2005 07:01 AM

something like:

Code:

$txt_array = file('/path/to/file.txt');
$db = ....connect to db

for($i=0;$i<count($txt_array);$i++)
{
  $sql = "insert into something where
}

...

FUCK THAT...

Can't you just format your text file like how the table is formatted and run something like:

>load data infile .....

-- search good for "load data in file" -- that'd be the fastest and easiest if possible.


All times are GMT -7. The time now is 05:18 AM.

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