Hello everyone. I hope someone can help me, I am a beginner in PHP.
I don't have any code right now to post, so please help me based on what I write.
I have two tables, computers and users. Each computer can have a user assigned to it. I want to display all users in the table and if the have a computer assigned to them, display that one too, if not leave blank. Ex:
user1 | pc1
user2 | blank
user3 | pc2
I have tried doing this via two loops. The first one (for) loops through the users db, the second one (inside the first one), loops through the computer db and checks if the userid in the user table matches the userid in the computer table.
It doesn't work right. It works only for the first row, it doesn't want to display the information. It seems that the inner loop works only once, for one single value passed from the outer loop and spews out all the results. Ex:
user1 | pc1 blank pc2
user2 | nothing
user3 | nothing
Can you please give me ANY SUGGESTIONS on how this can be done? I will try to post my code later this afternoon.
Thank you.