0

Dear All,

I have created a multi dimensional array and stored elements in that through while loop like
$human = array();
and at every iteration the while loop will add elements like
$human["IPI"]["Description"][] = $row;
$human["IPI"]["link"][]= $link;

but when i wanted to print this array contents in a table format i wrote it like this inside the table environment:

for ($i=0;$i<=$j;$i++)
			{
			echo '<tr>';
echo "<td>Chromosome</td><td>$human[IPI][Description][$i] ($human[IPI][link][$i])</td><td>$mouse[Chromosome]</td>";
			echo '</tr>';
			}

but it displays like Array[Description][0] (Array[link][0]) in the output table.

I would be thankful if anyone could help me with this issue.

Thanks in advance.

cheers,
Aravind

3
Contributors
6
Replies
7
Views
5 Years
Discussion Span
Last Post by diafol
0

Do a var_dump() on your array to be sure of it's structure.

You can also do this within your loop. Then it is just making sure you write the correct notation to reference the index you need.

0

Do a var_dump() on your array to be sure of it's structure.

You can also do this within your loop. Then it is just making sure you write the correct notation to reference the index you need.

0

Thanks for the reply.

yes the structure is absolutely right as i checked with var_dump(), i cannot do var_dump() in the loop as it has to print the array values depending on the input instead of printing all at once.

cheers,
Aravind

0

You have to brace the array vars:

echo '<tr>';
echo "<td>Chromosome</td><td>{$human['IPI']['Description'][$i]} ({$human['IPI']['link'][$i]})</td><td>{$mouse['Chromosome']}</td>";
			echo '</tr>';
0

Hi ardav,

Thanks a ton dude.....thats so cool.....worked like charm :cool:.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.