Create a Simple API In PHP with MySQL Database

Поділитися
Вставка
  • Опубліковано 14 гру 2024

КОМЕНТАРІ • 166

  • @mmhoq8828
    @mmhoq8828 3 роки тому +6

    A video should look likes that a new comer can learn without Instructor. You did the perfect job for a new learner.

  • @sirlexie9810
    @sirlexie9810 3 роки тому +8

    Luckily found this tutorial, I need to create a dummy API for my front end page, Great tutorial!

    • @CodesEasy
      @CodesEasy  3 роки тому

      Happy that it helped you

  • @hiranoor1723
    @hiranoor1723 Місяць тому +1

    Thanks sir, This task has not been done for many hours. A very good video according to my task.

  • @yinhlamakamu2624
    @yinhlamakamu2624 11 місяців тому +2

    Thank you so much, still relevant in 2024

    • @CodesEasy
      @CodesEasy  11 місяців тому

      Happy that you liked it

  • @matafungsi89
    @matafungsi89 Рік тому +2

    Great tutorial. Simple and ez to understand. Many tutorial out there are using classes. It make me confused 😵

  • @jies933
    @jies933 Рік тому +3

    aahhh thanks you guyz completely wrecked my 2 hour , in the line no 5 there `data` should bein back thick 😤😤😤😤

    • @CodesEasy
      @CodesEasy  Рік тому

      What is the error you are facing, explain it so we could help you 🙂

    • @jies933
      @jies933 Рік тому

      @@CodesEasy I resolved it , without the backtick the data was not visible 🗿

  • @usd00
    @usd00 2 роки тому +5

    Very informative & to the point
    Helped me a lot in making an API that I want to use with ReactJS

    • @CodesEasy
      @CodesEasy  2 роки тому

      Happy that the video helped you

  • @ATouchofClass196
    @ATouchofClass196 3 роки тому +2

    After a year its helped me, thanks a lot sir 😊

    • @CodesEasy
      @CodesEasy  3 роки тому

      Happy that it helped you

  • @Theceles81
    @Theceles81 2 місяці тому +1

    Thank you so much Sir, it help me a lot! Still good in 2024

  • @Undurkhaan
    @Undurkhaan 3 роки тому +2

    It's really good. Please continue this video further.

  • @carloseduardopaladinoalvin3816
    @carloseduardopaladinoalvin3816 3 роки тому +1

    Excellent explanation, workd prettu fine, thanks a lot !!

    • @CodesEasy
      @CodesEasy  3 роки тому

      Happy that it helped you

  • @SatinderSatsangi
    @SatinderSatsangi 3 роки тому +1

    Really Easy to understand, good work

    • @CodesEasy
      @CodesEasy  3 роки тому

      Happy that it helped you

  • @javadbarghamadi2768
    @javadbarghamadi2768 3 роки тому +1

    bravo..thanks..it was WONDERFUL

    • @CodesEasy
      @CodesEasy  3 роки тому

      Happy that you liked it

  • @rodrigodifederico
    @rodrigodifederico 3 роки тому +14

    1. PLEASE avoid Select *, internally the database will need to make 2 selects because of the "*". Always give the columns names for a select. If its too many columns, use an array then.
    2. You can simply return the fetch_all results, you dont need a loop nor output variable.
    Your code will be way cleaner, and won't affect database performance.

    • @CodesEasy
      @CodesEasy  3 роки тому +5

      Sure, will post videos on creating a complete secure and efficient way of creating api soon. This is a complete beginner level, trying to make things easy as possible.

  • @moifouss
    @moifouss 4 роки тому +1

    This is really simple... waiting for C (R = done) U D parts. Thanks !

  • @aakrandan
    @aakrandan 4 роки тому +2

    How did you connect the .php file to the sql database? I am new to this, i need bit explanation.

  • @Pankajsingh-fo6tu
    @Pankajsingh-fo6tu 3 роки тому +1

    Well explained.. thanks..hoping for more videos on php

  • @alihussainabro7694
    @alihussainabro7694 4 місяці тому +1

    Very helpful vdieo,
    Thanks

    • @CodesEasy
      @CodesEasy  4 місяці тому +1

      Glad it was helpful!

  • @cjcro6456
    @cjcro6456 3 роки тому +3

    Very informative! Thanks for creating. Would be nice to see this integrated with a token for security. And potentially integrated with power bi. Also even the ability to push info to the DB using the api :)

    • @CodesEasy
      @CodesEasy  3 роки тому +2

      Sure, we will be doing something soon.

    • @cjcro6456
      @cjcro6456 3 роки тому

      Fantastic!

    • @dislikecounter6392
      @dislikecounter6392 2 роки тому

      @@CodesEasy Thank you never used php before but with this video I was able to get the updated mslqi and post code for people to use with this tutorial still to get an understanding of a basic database connection

  • @felipemedina2279
    @felipemedina2279 3 роки тому +1

    Thank you dude. It helped me a lot

  • @Addicted2OILau
    @Addicted2OILau 4 роки тому +2

    GREAT VIDEO Short and To The Point

  • @samnayakawadi
    @samnayakawadi 3 роки тому +1

    Easy Pissy, Thanks. Subscribed

  • @yeswanth2813
    @yeswanth2813 4 роки тому +1

    Bro i have my own db idk how to access it in android studio can you help me

  • @gabrielfono844
    @gabrielfono844 3 роки тому +1

    why dont u use the prepared statement to avoid sql injection in your database??

    • @CodesEasy
      @CodesEasy  3 роки тому

      In this video we are not inserting any data so there was no need, also it's for beginners.

    • @gabrielfono844
      @gabrielfono844 3 роки тому

      @@CodesEasy right

  • @aigars2026
    @aigars2026 3 роки тому +1

    If I want to display 6 tables, and make some queries, I have to create multiple files or?

    • @CodesEasy
      @CodesEasy  3 роки тому

      You can do all in one file too it depends on your needs

    • @aigars2026
      @aigars2026 3 роки тому

      @@CodesEasy Thanks for info! Yeah I just have task for school, to make web api, from workbench (it's connected in phpmyadmin ...) and I think I should be fine with this as I need only screenshots not actual files.

  • @anjalidogra9675
    @anjalidogra9675 3 роки тому +1

    Best video, short and up to the point.

    • @CodesEasy
      @CodesEasy  3 роки тому +2

      Happy that it helped you

  • @kazimdrafiqulislam7420
    @kazimdrafiqulislam7420 3 роки тому +1

    Thanks
    It help me a lot

  • @poonambanasode891
    @poonambanasode891 3 роки тому +1

    Thank a lot for saving time!!!

    • @CodesEasy
      @CodesEasy  3 роки тому

      Happy that it helped you

  • @GuruPrakash745
    @GuruPrakash745 Рік тому +1

    please make a video on information about MySql, Sqlite what is the need and difference between
    and what is php plugins?

  • @KapitanOppa
    @KapitanOppa Рік тому +1

    do you have an actual tutorial that connects to a thrid party api

    • @CodesEasy
      @CodesEasy  Рік тому

      Third party api integration is different, not like this. What api you are implementing

    • @KapitanOppa
      @KapitanOppa Рік тому

      @@CodesEasy Clio, Bigcommerce, Shopify, Mailchimp something like that

    • @CodesEasy
      @CodesEasy  Рік тому

      Each service will have its own documentation. Check their website for that. We could try to create a video on any one specified about. But each of them will be having difference. Some might me having SDK's and some will be providing api end points. So their implementation will be different

  • @sadiqali3593
    @sadiqali3593 3 роки тому +1

    Thank you so much, dear :)

    • @CodesEasy
      @CodesEasy  3 роки тому

      Happy that it helped you

  • @mremptytuber
    @mremptytuber Місяць тому +1

    Now 2024 wait bro after 3 years my baby come to learn your code

  • @christbryan2521
    @christbryan2521 3 роки тому

    Thanks for your tutorial very easy to understand.

    • @CodesEasy
      @CodesEasy  3 роки тому

      Happy that you liked it

  • @Hadeszion
    @Hadeszion 4 роки тому

    this method support 10 million data of mysql? how to search for specific data in the url

  • @symsth16
    @symsth16 3 роки тому +2

    Thanks a lot broo!

    • @CodesEasy
      @CodesEasy  3 роки тому

      Happy that you liked it

  • @amajunrieldamalan2387
    @amajunrieldamalan2387 3 роки тому +1

    when I run the file, it says "Not found". why?

    • @CodesEasy
      @CodesEasy  3 роки тому

      Local host address will be wrong

    • @amajunrieldamalan2387
      @amajunrieldamalan2387 3 роки тому

      @@CodesEasy I tried running it on cmd and it works. But I still trying to figure out what's wrong with my localhost. Thanks for answering

  • @jayeshpatil5726
    @jayeshpatil5726 4 роки тому +2

    How to retrieve this Jeson data in android studio .???

    • @jayeshpatil5726
      @jayeshpatil5726 4 роки тому

      @@CodesEasy ok , I done data insert ,update , delete successfully . With some additional. Code in yours 👍

  • @tahmeenakhan6
    @tahmeenakhan6 4 роки тому +1

    What to do if we want to fetch pdf data from website in android ap.please respond

    • @CodesEasy
      @CodesEasy  2 роки тому

      if you dont have access to an api, you can scrap the html and take the pdf links then generate and api your self. Check if its allowed mt the website owner first.

  • @progtom7585
    @progtom7585 3 роки тому +1

    Thanks for the really short simple video.
    A few questions;
    Should the API request all fields from all tables or just those fields that will be exposed to the public?
    Does the API filter the data at all, or does it always just dumb request everything and the client side just requests what it wants?
    How do we filter this data (i know this is done in the URL request by using the API keys, but if my API isnt filtering the data returned (checking in the postman application), whats going on?

    • @CodesEasy
      @CodesEasy  3 роки тому +1

      Just use data that are necessary, select necessary data and display.

    • @progtom7585
      @progtom7585 3 роки тому

      @@CodesEasy thanks!

  • @gabposts3144
    @gabposts3144 4 роки тому +2

    OMG thank you very much!!!

  • @frontendprodesigner4299
    @frontendprodesigner4299 4 роки тому +1

    BRO I GOT THIS PROBLEM Warning: json_decode() expects parameter 1 to be string, array given in line echo json_decode($response, JSON_PRETTY_PRINT).. so how to solve this problem i see your code doesnt show error but when i try to practice i got the error above

  • @Yuh--
    @Yuh-- 4 роки тому +1

    how doing this with post method?

    • @CodesEasy
      @CodesEasy  4 роки тому

      This is an api creation demo

  • @banban7705
    @banban7705 3 роки тому +1

    Do u have a tutorial on how to get the data on two different database using API?

    • @CodesEasy
      @CodesEasy  3 роки тому

      You will have to change the connected database and then to the operation on second db.

  • @retsamgraphics7407
    @retsamgraphics7407 3 роки тому

    as a beginner the question i have is why do we need to create API like this..why can we access the database directly and get values.

    • @CodesEasy
      @CodesEasy  3 роки тому

      If you are referring to android apps, yes you need APIs for making everything easy and fast.

  • @kenan336
    @kenan336 4 роки тому +1

    Fatal error: Cannot use temporary expression in write context in C:\xampp\htdocs\

    • @CodesEasy
      @CodesEasy  4 роки тому

      Some error with your scripts.

  • @pavankumar-of4ew
    @pavankumar-of4ew 3 роки тому +1

    i was looking for creating api, now i got with simple concept,thank you,but how to embed from libraries and create

    • @CodesEasy
      @CodesEasy  3 роки тому

      There are other videos on our channel check them

  • @user-qh7er8fp2o
    @user-qh7er8fp2o 2 роки тому +1

    thank you bro

    • @CodesEasy
      @CodesEasy  2 роки тому

      Happy that you liked it

  • @gabasanjeev
    @gabasanjeev 3 роки тому +1

    Thanks a lot Sir no words to express my gratitude!!!

  • @mulhamalamry
    @mulhamalamry Рік тому +1

    how to do a post rquest?

    • @CodesEasy
      @CodesEasy  Рік тому

      Check this. ua-cam.com/video/CjEWtaZW5Ck/v-deo.html

    • @mulhamalamry
      @mulhamalamry Рік тому

      @@CodesEasy i want to do it in javascript

    • @CodesEasy
      @CodesEasy  Рік тому

      ua-cam.com/video/HO_gdovoQMY/v-deo.html for js

    • @mulhamalamry
      @mulhamalamry Рік тому

      @@CodesEasy thank u

    • @mulhamalamry
      @mulhamalamry Рік тому

      @@CodesEasy sub added

  • @restuaverian4183
    @restuaverian4183 3 роки тому +1

    Thank you !

    • @CodesEasy
      @CodesEasy  3 роки тому

      Happy that you liked it

  • @muhammed4d
    @muhammed4d 8 місяців тому

    How can I create a very secure API?

  • @jabrawiofficial8839
    @jabrawiofficial8839 3 роки тому +1

    Thanks dear sir

    • @CodesEasy
      @CodesEasy  3 роки тому

      Happy that you liked it

  • @justnow7263
    @justnow7263 4 роки тому +1

    Please I need little bit explanation, what can i do this api or what he can do.

    • @pankajs271178
      @pankajs271178 4 роки тому

      Accept this data in any frontend JS library. These API's are especially meant for asynchronus data extraction / posting

  • @noumanashraf9336
    @noumanashraf9336 3 роки тому +2

    Please make a video and attached this php code with android studio and fetch data in app

    • @CodesEasy
      @CodesEasy  3 роки тому

      All the necessary files are there in the description.

  • @sannsantiago7425
    @sannsantiago7425 3 роки тому +1

    Would you help me with a small project, that is to link an api to another?! How much would you charge me?

    • @CodesEasy
      @CodesEasy  3 роки тому

      Sure, contact whatsapp.codeseasy.com

  • @jainamshroff4998
    @jainamshroff4998 4 роки тому +1

    Wow, Thank You !

    • @jainamshroff4998
      @jainamshroff4998 4 роки тому

      Just One Suggestion, Please Provide Source Code In Description For Easy Access. Thank You

  • @aritrochakraborty8122
    @aritrochakraborty8122 4 роки тому

    sir its not showing any output, when I opened it in localhost....
    can you please help me..??

  • @usmankhawar888
    @usmankhawar888 2 роки тому +1

    Good Tutorial Bro.
    Is there a way that instead of calling all the data. We can only get one we required. Creating an API that somehow asks to enter the name and will only return data containing that name
    Thanks

    • @CodesEasy
      @CodesEasy  2 роки тому +1

      Yes, just change the SQL query like select name from tablename;

    • @usmankhawar888
      @usmankhawar888 2 роки тому +2

      @@CodesEasy Thanks For Replying. What I am trying to ask is creating an API that asks for name then searches for it.
      Actually I am trying to create an APP that asks for name and when you press search it will search mysql database and return all column values by that name.
      Is there a way to create an API that asks the user and then alter the code you made like this
      SELECT * FROM database WHERE name LIKE + "here it gets the value from client side"
      Currently I am returning all the data as you described here and then Re-Search the values in $response array. And then output the values I required but as the database contain 300,000 entries it took 1 min to give response
      Sorry if I am unable to express my question. Still glad you replied

    • @CodesEasy
      @CodesEasy  2 роки тому

      Since you have that much data, you have to use an algorithmic approach to search, to get better speed.

    • @CodesEasy
      @CodesEasy  2 роки тому +1

      Right now your SQL query can be like select name from table where name like 'Codes%';
      Now this returns everything that starts with codes

    • @usmankhawar888
      @usmankhawar888 2 роки тому

      @@CodesEasy @Codes Easy YES. name like 'Code%' (that code)
      currently the code is SELECT * FROM database.
      It returns all the values in the database.
      I dont know how to insert value here,
      SELECT * FROM database (WHERE name LIKE (get value from client side))

  • @AliHaider_786
    @AliHaider_786 5 місяців тому +1

    Great❤

    • @CodesEasy
      @CodesEasy  5 місяців тому +1

      Happy that you liked the video

  • @Zen-lz1hc
    @Zen-lz1hc 3 роки тому +1

    Perfect
    Thanks

  • @chandrashekarkankanala1600
    @chandrashekarkankanala1600 Рік тому +1

    where is the code

    • @CodesEasy
      @CodesEasy  Рік тому

      Check the description. If the video is too small we might not provide the source code some times. Check the video description always for the source code

  • @mtsalur
    @mtsalur 4 роки тому +1

    thank you

    • @CodesEasy
      @CodesEasy  4 роки тому

      Happy that you liked it

  • @AtomTCP
    @AtomTCP 2 роки тому +1

    This is good but how to protect of other people, every guy who know how to use fetch in javascript can get data from db using this method. This isnt secured bro.

    • @CodesEasy
      @CodesEasy  2 роки тому

      You can implement basic auth for that.

  • @fmohtadi99
    @fmohtadi99 2 роки тому +1

    Is this API???? you've just connected mySql. Api is different :)

    • @CodesEasy
      @CodesEasy  2 роки тому

      This video is mainly for connecting android to MySQL

  • @sjn_
    @sjn_ 4 роки тому +1

    Ok seriously who uses mysqli in 2020? Why don't the tutorial makers ever encourage their viewers to use PDO with anonymous query parameters?

    • @CodesEasy
      @CodesEasy  4 роки тому

      Sure. Will make tutorial on it too.

    • @superjp335
      @superjp335 3 роки тому

      PDO is for object orriented programming...

  • @spiderangelo
    @spiderangelo 3 роки тому +1

    Why this is called API? This is just querying a MySQL database!!!!!

    • @CodesEasy
      @CodesEasy  3 роки тому

      It's a very simple and basic level, we use the output on mobile apps.

  • @Jeff-zc6rr
    @Jeff-zc6rr 2 роки тому +1

    This is not an api... lots of paid commenters.

    • @CodesEasy
      @CodesEasy  2 роки тому

      It's to read from database and print in json format.

  • @arpitasaxena7533
    @arpitasaxena7533 2 роки тому +1

    Bro this is not a API its just a Database query

    • @CodesEasy
      @CodesEasy  2 роки тому

      It's a video on how to fetch data and display it in json format. Mostly for my android tutorials, so that I could refer this

    • @CodesEasy
      @CodesEasy  2 роки тому

      What where you looking for. We would like to make a video on that too if you could explain.

  • @jayakumarmhk2486
    @jayakumarmhk2486 4 роки тому

    Thanks alooot

  • @khadijah-tul-qubrar2371
    @khadijah-tul-qubrar2371 4 роки тому

    Nice

  • @ciscop2000
    @ciscop2000 3 роки тому +1

    I love you

    • @CodesEasy
      @CodesEasy  3 роки тому +1

      ❤️ Happy that it helped you.

  • @rydercarter7035
    @rydercarter7035 3 роки тому +1

    Noob. This wasn't an example of a rest API. You just fetched data from the database using Mysqli functions and outputted it in the browser in a json format.

    • @CodesEasy
      @CodesEasy  3 роки тому

      It doesn't matter much, it's basically for beginners and is optimised for commonly used keywords. If you would like to have a detailed video on REST, Restful and web api we will post something about it soon. 👍

  • @igu642
    @igu642 6 місяців тому

    ❤❤

  • @augustinantony7085
    @augustinantony7085 4 роки тому

    Wow 😍😍