When I call the schript from one place everything works fine and when I call it from another place (in exactly the same way) there are no results comming back from the database. When I do a print of the database Query and past that into phpmyadmin for testing, everything works fine, also with the query that does not return the data...
In the posted code, you are not doing any error checking on the DBI->connect call, so based on what you say the problem is, I'd guess that when running it from "another place", the connection is failing.
Try writing your connect call in this form, and see what happens:
$db_homenet = DBI->connect( ... ) or die "DBI connect failed: $DBI::er
+rstr";
While you're at it, look at the DBI man page about the "RaiseError" attribute (which you set via the connect call), and/or consider adding error traps at each of the "prepare" and "execute" calls.