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

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.

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.

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

Member Avatar for diafol

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>';

Hi ardav,

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

Member Avatar for diafol

OK, mark as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.