Thanks for that quick reply. I have settings on the uploaded_files folder at 777. When I don't add the sql code, everything works. This error only occurs when I add the sql code shown above.