Skip to content

codehub-learn/php-pfizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction to PHP and MySQL

In order to run these exercises we need to install the following technologies locally:

  • PHP 8
  • MySQL 8

Run PHP Examples

These examples aim to help students to grasp the fundamental principles of PHP.

You need to follow some steps in order to run these PHP examples in your machine:

  1. Install PHP 8 locally

  2. Install Visual Studio Code so you can open and tweak the examples under PHP folder

  3. Open Visual Studio Code and install the PHP Server extension so you can run PHP through your IDE. At this stage you should have installed already PHP 8 locally

  4. Select an example and launch the PHP server through the context menu with right click by selecting "PHP Server: Serve project". The server needs to start just once. From now on, just select "PHP Server: Open file in browser" to play with the rest examples

PHP Server

Run MySQL Examples

These are some simple PHP examples where we connect with MySQL through MySQLi and PDO in order to retrieve actual data from the DB.

You need to follow some steps in order to run these examples in your machine:

  1. Setup PHP 8 locally first, as shown in the section above

  2. Setup MySQL 8 locally

  3. Connect with MySQL:

$ mysql -u root -p
  1. Create a DB named "demo":
$ mysql> create database demo;
  1. Select the "demo" database and run the dump.sql script that is included in the assets folder:
$ mysql> use demo;
$ mysql> source dump.sql;
  1. Execute an example in the command line:
$ php example-1.php

MySQL

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages