I have an array of 3 columns in which I have the second column which is an array in php.The second column which is an array can have 2-6 rows.
I put the data in the array with key with the below code
$data_array = array(
'name' =>$name,
'category_name'=>$category_name,
'url'=>$url
);
The second column $category_name in the above $data_array is an array which has data like below
$category_name = array("India", "USA", "UK");
I want to echo the the data in the following format and eventually add it the mysql database
'Jim'
'India'
'www.google.com'
'Jim'
'USA'
'www.google.com'
'Jim'
'UK'
'www.google.com'
'John'
'India'
'www.yahoo.com'
'John'
'USA'
'www.yahoo.com'
'John'
'UK'
'www.yahoo.com'
If you notice the first and third row remain same and the second row changes according to the data in the category_name array
I am trying to use the below code to achieve this but I am getting no output
for($i=0;$i<count($NPR);$i++){
for($j=0;$j<count($NPR[$i]['category_name'][j]);$j++){
echo "'".$NPR[$i]['name']."'<br>";
echo "'".$NPR[$i]['category_name'][j]."'<br>";
echo "'".$NPR[$i]['url']."'<br>";
}
}