Programming Economic Experiments with Php/mysql

with contributions by:
Boris van Leeuwen
Roel van Veldhuizen
Jona Linde
Lucas Molleman
Joep Sonnemans
Jeroen van de Ven

Set up


Download all the files on this page in one zip-file.

When you (the programmer) are in the lab, you can easily change parameters in the commonparameter table, download results and empty tables with phpmyadmin. However, if someone who is less experienced is running the experiment, it may be a good idea to help them with a separate page for all these things. Boris van Leeuwen has programmed some code for this purpose: see the left picture.

The page setup.php let you check the current parameters in the commonparameter table (adapt this to the the relevant parameters in your experiment) and has some buttons at the bottom that link to exportmysqldatabase.php which exports the current database in csv (excel) format, emptydatatables.php that empties the datafiles ppnummers and results. In addition their is a button to randomize something (used in a specific experiment, not included here), but likewise you may put here a link to a page like roundrobin.php (in the file) that organizes a stranger design for two-person games (you can only run this after you know the exact number of participants).

You can also use a more general version setupGeneral.php which is based upon Boris' version; see the right picture. It shows all parameters in the commonparameters table in alphabetic order with their current values, so you don't have to change this page at all for use in another experiment. However, setupGeneral.php assumes that your commonparameters table has a third column named comment. For each parameter the comment is shown after the input field. This column may be a good idea even if you don't use this page, because it helps interpret your data when you have to look at it years after running the experiment!

In the zipfile you will also find the page exportmysqltable.php that can be used to download one specific table (for example, exportmysqltable.php?table=ppnummers will download an excelfile with the ppnummers table). It is included but we strongly advise to download the whole database after every session, because the commonparameters table will be included, which avoids later confusion about in what session what treatment was employed.