theside
11-13-2010, 10:34 PM
Hi all
I have 4 arrays:
$link
$title
$description
$pubDate
They each contain 10 items and as their names woudl suggest, contain links, titles descriptions and published dates.
Each of the four arrays contain information relating to the other,
I.e.
$link[0] is the link for $title[0] which is the title for $description[0] which is the description for $pubDate[0]
and
$link[1] is the link for $title[1] which is the title for $description[1] which is the description for $pubDate[1]
and so on....
Now, I want to put these into a MySQL table so that each row in the MySQL table contains the correct information for each item
I know that if I only had one array (e.g. $link) i would use
foreach( $link as $item )
{
/* ... MySQL INSERT command */
}
BUT, how would I go about dealing with the 4 arrays?
I'm guessing I need to make a huge array of the type:
$each_item = array(0 =>$link[0], $title[0], $description[0], $pubDate[0]);
and then i have one array which i can loop through and insert into the MySQL table
I've looked at the combine_array function - I do not think this is what I require here...
Your comments will be gratefully receievd
Many thanks
k
I have 4 arrays:
$link
$title
$description
$pubDate
They each contain 10 items and as their names woudl suggest, contain links, titles descriptions and published dates.
Each of the four arrays contain information relating to the other,
I.e.
$link[0] is the link for $title[0] which is the title for $description[0] which is the description for $pubDate[0]
and
$link[1] is the link for $title[1] which is the title for $description[1] which is the description for $pubDate[1]
and so on....
Now, I want to put these into a MySQL table so that each row in the MySQL table contains the correct information for each item
I know that if I only had one array (e.g. $link) i would use
foreach( $link as $item )
{
/* ... MySQL INSERT command */
}
BUT, how would I go about dealing with the 4 arrays?
I'm guessing I need to make a huge array of the type:
$each_item = array(0 =>$link[0], $title[0], $description[0], $pubDate[0]);
and then i have one array which i can loop through and insert into the MySQL table
I've looked at the combine_array function - I do not think this is what I require here...
Your comments will be gratefully receievd
Many thanks
k