AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Communication Technology

The connection page

Week 11 · Unit 3 Creating Site Pages (4), Topic 1 (end): the page that connects to the database: what a connection needs, reading a connection page, keeping secrets · 3 lessons
Answers are for parents and teachers.
1
Write four PHP lines that store the four connection facts for a database called dbclub, using an invented user and a placeholder password.
2
A pupil writes: if ($connect) { … } else { echo "not connected"; } after mysqli_connect. Explain why the else part is never used in PHP 8.1 and later, and what to use instead.
3
Which of these should never be shown to a visitor: (a) the sentence “Please try again later”, (b) the password, (c) the server’s full error text?
4
Give two reasons why the connection code lives in one included file.
5
What is the use of a character set in the connection?