If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

where the $etc_id2 is like library or room and $id is book
[book] => Array
(
[0] => library
[1] => room
)
But problem is when i //echo $etc_id2."\n" after if($rodic1 ==$id) i get only [0] => library.
My question in here is why i cant get [1] => room . And how can i change mzı code to get it .
Thank you for read my post and help

I'm sorry but it looks like I wasn't fully paying attention to your nested loops. It seems you have 2 arrays you are looping through: $result2 and $etc_uloziste. Could you share the $etc_uloziste array as well so I can compare these two arrays?

"Given billions of tries, could a spilled bottle of ink ever fall into the words of Shakespeare?"

Alright, bare in mind that I don't really understand the data structure you have in the sense that I have no idea what this data is for and what it means. Thus I'm not really sure what you are trying to achieve here or what the goal for this data is.

From what I can tell though, there isn't anything 'wrong' with your code. This is just a matter of you need to loop through these arrays differently to get the result you want. Which goes back to the fact that I don't know exactly what you are trying to achieve so I can't really tell you what your code should look like.

I can however make a suggestion that could help you see exactly what's going on in your code and thus help you tweak it to your needs.

Now to explain what this is and how it might help. You are comparing $rodic1 and $id in your if() statement before you echo out $etc_id2 on the page. If you run this, it will echo out every single if() statement so you can see exactly what the code compares, and in parenthesis it echoes out the value that would be shown on the page if the statement is true.

Since you are expecting to see 2 values from part of your array but are only seeing one of them instead, running this will show you every value (including the ones you expect to see), but will show the if() statement being used to show or not show that value. So you should be able to look for '[1] => room' (in parenthesis) and find out which if() statement is being used. There you will be able to see why it doesn't match and thus why you don't see it on the page.

Keep in mind this is just a way to help you debug your own problem. Because I know nothing about this data or what you are trying to achieve I can't be of much more help at the moment. If you could explain what it is you are trying to do then I could work out the issue myself and help you organize your loops.

"Given billions of tries, could a spilled bottle of ink ever fall into the words of Shakespeare?"