I am trying to convert my php array into html using php implode.
This is my code:
$myarray = array();
while ($row = mysql_fetch_assoc($result)) {
$myarray[] = array("title"=>$row['title'],
"name"=>$row['title'],
"content"=>$row['content'],
"image" =>
array(
"cls"=>"slide-image",
"_src"=>$row['src'],
"source"=>$row['source']
)
);
}
and
$rows = array_fill( 0, count( $myarray[0] ), "" );
$keys = array_keys( $myarray[0] );
foreach( $myarray as $k => $record )
for( $i=0, $max=count( $rows ); $i < $max; $i++ )
$rows[ $i ] .= $record[ $keys[ $i ] ];
print implode( "", $rows );
The output is
title 1, title-2, content for title 1, content for title 2ArrayArray
I want as
title 1, content for title 1, title 2, content for title 2
and i don't know why the Array is coming. Any help please ?