03.03.2013, 09:11
Not on topic, but i noticed you have a memory leak there. You don't free the first select query before executing the next one, and you should.
You also don't need two select queries, the first one holds the same data that the second one does.
You also don't need two select queries, the first one holds the same data that the second one does.