Contents


Exercise PHP and Databases

  1. pg_connect and pg_close:
    Access the workshop DB using a PHP script, check the connection status and close it again.

  2. pg_query:
    Access the workshop DB using a PHP, query the stud table with (SELECT * ...) and print it in the same format psql does (to a terminal or as HTML page). Compare the functions: pg_fetch_row, pg_fetch_array and pg_fetch_result.

  3. SQL Errors:
    Write a HTML form to insert/delete a student from the stud table in the workshop DB. The PHP script that is called by the form checks if the desired action is possible or would lead to an error.

  4. Copy:
    Copy the PHP stud array to a table "c_test" in the workshop DB (the fields in DB must fit the array).
    Copy c_test back into a PHP array and check the data.

  5. Login Form:
    Implement a login form for the projects in the workshop DB. Only participants of a project (supervising teacher and students) are allowed to access a project's web-page, which displays the project table.