sarahk,
Thanks for your suggestion but it doesn't work in my case since I want all the rows from table1 and all the rows from table2 where "id" field is matching, but the fact is that table1 is much bigger than table2, so there are many entries in table1 that don't have matching rows in table2. So, that's why I'm using JOIN.
The problem is in MySql configuration because at home, I have no problems, but when I upload data to my host, this is when things are happening. I could solve easily problems if I use arrays and not objects, but I am not sure if anyone here knows of a configuration line for MySql that will solve my problem.
Thanks again and if you have any other suggestions, please let me know.