subject

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ykarmi
Forum Commoner
Posts: 35
Joined: Mon Oct 30, 2006 4:45 pm

subject

Post by ykarmi »

message
Last edited by ykarmi on Sat Jun 27, 2009 2:25 am, edited 1 time in total.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

Example of doing 2 of them. Just continue with comma seperation and you should be fine..

Code: Select all

$sql = "INSERT INTO your_table_name_here (field1, field2, field3, field4) VALUES ('Aldora', '349','GER', '&nbsp'), ('Amera', '541', 'USA', '&nbsp');
$rst = mysql_query($sql) or die(MySQL_ERROR());
ykarmi
Forum Commoner
Posts: 35
Joined: Mon Oct 30, 2006 4:45 pm

subject

Post by ykarmi »

message
Last edited by ykarmi on Sat Jun 27, 2009 2:26 am, edited 1 time in total.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

You could use explode, (array_shift,) array_chunk and foreach - in this order.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Post by califdon »

What is your data source, a document? What do you mean by "The page is sorted so that every four lines are supposed to be inserted into one row in the database"? Is the page a document, like a text file??
Post Reply