On your last line of code, you use $_GET, change it to $HTTP_GETT_VARS. That might fix a problem
Also, you set the two global variables near the top, I think that is redundant, as they are already global, but it mayu not really affect your script's functioning.
You are also using the Database Class' function fetchOneArray($query, false) and you may want to look at the code in there. You might be using some PHP function that wasn't implemented until later than 4.0.6.