إعلانيمكن أن تكون علامتك التجارية هناعلامتك التجارية هنافي كل صفحة من Darslab · طلاب وأولياء أمور ومعلمونinfo@darslab.comاسأل عن الأسعارالأسعارinfo@darslab.com
☰ خطة العام · تكنولوجيا المعلومات والاتصالات (بالإنجليزية)

The connection page

الأسبوع 11 · الوحدة ٣ «إنشاء صفحات الموقع» (٤) الموضوع الأول (نهاية): صفحة الاتصال بقاعدة البيانات: ما يحتاجه الاتصال، قراءة صفحة الاتصال، حفظ الأسرار · 3 دروس
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?