PHP Programming Basics Practice Test: Working With Databases in PHP — Flashcards | PHP & Programming | FatSkills

PHP Programming Basics Practice Test: Working With Databases in PHP — Flashcards

Fast review mode: answers are shown by default so you can skim quickly. Hide them if you want to self-test.

PHP can be used to connect to databases using the XAMPP web server, which is lightweight and can be used for website development.

Here are some steps to retrieve data from a database in PHP:
Establish a connection with the server
Select the database
Execute the MySQL select query
Display the fetched data
Close the connection with the server

Here are some examples of code to retrieve data from a database:
Fetch data from a table named "employee" in a database named "company": `$connection = mysql_connect(``localhost'', ``root'', ``''); 
$db = mysql_select_db(``company'', $connection);
$query = mysql_query(``select * from employee'', $connection);
Name: <?php echo $row1('employee_name'); ?>
E-mail: <?php echo $row1('employee_email'); ?>
mysql_close($connection);`
Create a database: phpmyadmin database
Create a folder named ``demo'' inside htdocs: register.php 

1 of 19 Ready
Which one of the following databases has PHP supported almost since the beginning?
MySQL
Shortcuts
Prev Space Show / hide Next
Turn this into a study set.
Sign in with Google to save tricky questions to your reminder list and resume on any device.
Sign in with Google Free • no extra password