Again, I have to ask: does your query work from the command line? If you are not sending the right query, then you won't get the right results.
I don't know what 'annons.område' is but you are comparing it to 'områden.id'. Are they both the same data type?
You also have 'annons.rubrik=annons.id'. Are those both the same data types?
And if all you want is $id2, why are you selecting 11 fields? Or do they all make up $id2?
Your first priority is to find out exactly what your queries contain. Print them out. Or test them from the command line before you try to get it working in your script. If you know your SQL query works, then the problem is your programming, and this is the wrong forum for that.
Last edited by trudge : Apr 27th, 2008 at 5:21 pm.
Amer Neely - Web Mechanic
"Others make web sites. We make web sites work!"