Unable to delete printed word & ldquo; Array & rdquo;

advertisements

I retrieved data from MySQL but the result is like this: http://sparrow.site90.net/select.php

It shows the word (Array) before the retrieved information. I tried so hard to remove this word from the table but I could not.

Here is my code. What can I do about it?

echo "<td>" . $array = unserialize($row['Favorite_courses']);
foreach($array as $item) {
    echo $item, ", ";
}
echo "</td>";


The first row concatenates the array's textual representation (which, in PHP, is "Array") and the starting element <td>. Here's what you should do:

$array = unserialize($row['Favorite_courses']);
echo "<td>";
foreach($array as $item) {
    echo $item, ", ";
}
echo "</td>";