![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Join Date: Jan 2005
Posts: 1,648
|
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? ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Join Date: Feb 2005
Location: Budapest, Hungary
Posts: 534
|
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?
![]()
__________________
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Industry Role:
Join Date: Dec 2002
Location: Behind the scenes
Posts: 5,190
|
batch import: http://sunsite.mff.cuni.cz/MIRRORS/f...atch_mode.html
the example is not clear in regards to mysql subject
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Join Date: May 2004
Location: South Florida
Posts: 4,134
|
if its a html submit use a loop, otherwise you can use a txt file and then import into mysql.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 | |
Confirmed User
Join Date: Jan 2005
Posts: 1,648
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Join Date: Apr 2003
Location: Loveland, CO
Posts: 5,526
|
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 } ... 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.
__________________
Your post count means nothing. |
![]() |
![]() ![]() ![]() ![]() ![]() |