Skip to content

parisa-khaleghi/Simple-API-PHP-MySQL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Simple API PHP/MySQL

Create a Simple API In PHP with MySQL Database.

If you want to have a simple API with PHP/MySQL. This is a full guide for you.First you need to know, I did this project using a youtube video on this link. Also, you can follow steps here and use the code in the repository.

Start from here

  1. Go to phpMyAdmin and Create a database. (e.g. simple_api_DB)
  2. Create a table and insert some data on it, or you can import the sql file avalable in sql directory in here.
  3. Create a php file. I made it on a 'src' directory.
  4. Create connection with database in a php file using: $mysqli = new mysqli("localhost","my_user","my_password","my_db");
  5. Test the connection.
  6. Add the code to fetch data and print as JSON.