I checked out this example but I don't think that the script makes a connection with a database. IT reads files from a csv file, which is a different case. So the question remains:
Is there a a way to query a database in order to pre-fill the answer of a question in a limesurvey questionnaire?"
In my local installation of Limesurvey (using xampp) I placed the php file in the htdocs/limesurvey directory (where also other limesurvey php files are located) and it worked fine.
Hope you find this info helpful!
The administrator has disabled public write access.