Create a Simple API In PHP with MySQL Database

  Рет қаралды 151,634

Codes Easy

Codes Easy

Күн бұрын

Пікірлер: 160
@mmhoq8828
@mmhoq8828 3 жыл бұрын
A video should look likes that a new comer can learn without Instructor. You did the perfect job for a new learner.
@CodesEasy
@CodesEasy 3 жыл бұрын
Happy to hear that.
@sirlexie9810
@sirlexie9810 3 жыл бұрын
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
@yinhlamakamu2624
@yinhlamakamu2624 8 ай бұрын
Thank you so much, still relevant in 2024
@CodesEasy
@CodesEasy 8 ай бұрын
Happy that you liked it
@usd00
@usd00 2 жыл бұрын
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
@matafungsi89
@matafungsi89 11 ай бұрын
Great tutorial. Simple and ez to understand. Many tutorial out there are using classes. It make me confused 😵
@CodesEasy
@CodesEasy 11 ай бұрын
Glad it was helpful!
@jies933
@jies933 Жыл бұрын
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 🗿
@ATouchofClass196
@ATouchofClass196 3 жыл бұрын
After a year its helped me, thanks a lot sir 😊
@CodesEasy
@CodesEasy 3 жыл бұрын
Happy that it helped you
@Undurkhaan
@Undurkhaan 3 жыл бұрын
It's really good. Please continue this video further.
@CodesEasy
@CodesEasy 3 жыл бұрын
Happy to hear that
@alihussainabro7694
@alihussainabro7694 Ай бұрын
Very helpful vdieo, Thanks
@CodesEasy
@CodesEasy Ай бұрын
Glad it was helpful!
@moifouss
@moifouss 4 жыл бұрын
This is really simple... waiting for C (R = done) U D parts. Thanks !
@AliHaider_786
@AliHaider_786 2 ай бұрын
Great❤
@CodesEasy
@CodesEasy 2 ай бұрын
Happy that you liked the video
@aakrandan
@aakrandan 4 жыл бұрын
How did you connect the .php file to the sql database? I am new to this, i need bit explanation.
@cjcro6456
@cjcro6456 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 жыл бұрын
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
@SatinderSatsangi
@SatinderSatsangi 2 жыл бұрын
Really Easy to understand, good work
@CodesEasy
@CodesEasy 2 жыл бұрын
Happy that it helped you
@javadbarghamadi2768
@javadbarghamadi2768 3 жыл бұрын
bravo..thanks..it was WONDERFUL
@CodesEasy
@CodesEasy 3 жыл бұрын
Happy that you liked it
@GuruPrakash745
@GuruPrakash745 Жыл бұрын
please make a video on information about MySql, Sqlite what is the need and difference between and what is php plugins?
@CodesEasy
@CodesEasy Жыл бұрын
Sure. 👍
@carloseduardopaladinoalvin3816
@carloseduardopaladinoalvin3816 3 жыл бұрын
Excellent explanation, workd prettu fine, thanks a lot !!
@CodesEasy
@CodesEasy 3 жыл бұрын
Happy that it helped you
@Pankajsingh-fo6tu
@Pankajsingh-fo6tu 3 жыл бұрын
Well explained.. thanks..hoping for more videos on php
@CodesEasy
@CodesEasy 3 жыл бұрын
Sure 👍
@Addicted2OILau
@Addicted2OILau 3 жыл бұрын
GREAT VIDEO Short and To The Point
@CodesEasy
@CodesEasy 3 жыл бұрын
Glad it was helpful!
@rodrigodifederico
@rodrigodifederico 3 жыл бұрын
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 жыл бұрын
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.
@anjalidogra9675
@anjalidogra9675 3 жыл бұрын
Best video, short and up to the point.
@CodesEasy
@CodesEasy 3 жыл бұрын
Happy that it helped you
@gabposts3144
@gabposts3144 4 жыл бұрын
OMG thank you very much!!!
@yeswanth2813
@yeswanth2813 4 жыл бұрын
Bro i have my own db idk how to access it in android studio can you help me
@symsth16
@symsth16 2 жыл бұрын
Thanks a lot broo!
@CodesEasy
@CodesEasy 2 жыл бұрын
Happy that you liked it
@poonambanasode891
@poonambanasode891 3 жыл бұрын
Thank a lot for saving time!!!
@CodesEasy
@CodesEasy 3 жыл бұрын
Happy that it helped you
@samnayakawadi
@samnayakawadi 3 жыл бұрын
Easy Pissy, Thanks. Subscribed
@CodesEasy
@CodesEasy 3 жыл бұрын
👍
@felipemedina2279
@felipemedina2279 3 жыл бұрын
Thank you dude. It helped me a lot
@CodesEasy
@CodesEasy 3 жыл бұрын
Glad it helped
@sadiqali3593
@sadiqali3593 3 жыл бұрын
Thank you so much, dear :)
@CodesEasy
@CodesEasy 3 жыл бұрын
Happy that it helped you
@kazimdrafiqulislam7420
@kazimdrafiqulislam7420 3 жыл бұрын
Thanks It help me a lot
@CodesEasy
@CodesEasy 3 жыл бұрын
Glad it helped you.
@Hadeszion
@Hadeszion 4 жыл бұрын
this method support 10 million data of mysql? how to search for specific data in the url
@jabrawiofficial8839
@jabrawiofficial8839 2 жыл бұрын
Thanks dear sir
@CodesEasy
@CodesEasy 2 жыл бұрын
Happy that you liked it
@pavankumar-of4ew
@pavankumar-of4ew 3 жыл бұрын
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
@restuaverian4183
@restuaverian4183 2 жыл бұрын
Thank you !
@CodesEasy
@CodesEasy 2 жыл бұрын
Happy that you liked it
@KapitanOppa
@KapitanOppa Жыл бұрын
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
@christbryan2521
@christbryan2521 2 жыл бұрын
Thanks for your tutorial very easy to understand.
@CodesEasy
@CodesEasy 2 жыл бұрын
Happy that you liked it
@jainamshroff4998
@jainamshroff4998 4 жыл бұрын
Wow, Thank You !
@jainamshroff4998
@jainamshroff4998 4 жыл бұрын
Just One Suggestion, Please Provide Source Code In Description For Easy Access. Thank You
@noumanashraf9336
@noumanashraf9336 3 жыл бұрын
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.
@Zen-lz1hc
@Zen-lz1hc 3 жыл бұрын
Perfect Thanks
@CodesEasy
@CodesEasy 3 жыл бұрын
Happy to hear
@user-qh7er8fp2o
@user-qh7er8fp2o 2 жыл бұрын
thank you bro
@CodesEasy
@CodesEasy 2 жыл бұрын
Happy that you liked it
@gabrielfono844
@gabrielfono844 3 жыл бұрын
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
@muhammed4d
@muhammed4d 6 ай бұрын
How can I create a very secure API?
@aigars2026
@aigars2026 3 жыл бұрын
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.
@banban7705
@banban7705 3 жыл бұрын
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 2 жыл бұрын
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 2 жыл бұрын
If you are referring to android apps, yes you need APIs for making everything easy and fast.
@progtom7585
@progtom7585 3 жыл бұрын
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 жыл бұрын
Just use data that are necessary, select necessary data and display.
@progtom7585
@progtom7585 3 жыл бұрын
@@CodesEasy thanks!
@frontendprodesigner4299
@frontendprodesigner4299 3 жыл бұрын
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
@CodesEasy
@CodesEasy 3 жыл бұрын
It's not json_decode() it's json_encode()
@frontendprodesigner4299
@frontendprodesigner4299 3 жыл бұрын
@@CodesEasy thank you sir i solved it now its working
@mtsalur
@mtsalur 3 жыл бұрын
thank you
@CodesEasy
@CodesEasy 3 жыл бұрын
Happy that you liked it
@kenan336
@kenan336 3 жыл бұрын
Fatal error: Cannot use temporary expression in write context in C:\xampp\htdocs\
@CodesEasy
@CodesEasy 3 жыл бұрын
Some error with your scripts.
@tahmeenakhan6
@tahmeenakhan6 3 жыл бұрын
What to do if we want to fetch pdf data from website in android ap.please respond
@CodesEasy
@CodesEasy Жыл бұрын
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.
@jayeshpatil5726
@jayeshpatil5726 4 жыл бұрын
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 👍
@AtomTCP
@AtomTCP 2 жыл бұрын
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.
@amajunrieldamalan2387
@amajunrieldamalan2387 2 жыл бұрын
when I run the file, it says "Not found". why?
@CodesEasy
@CodesEasy 2 жыл бұрын
Local host address will be wrong
@amajunrieldamalan2387
@amajunrieldamalan2387 2 жыл бұрын
@@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
@usmankhawar888
@usmankhawar888 2 жыл бұрын
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 жыл бұрын
Yes, just change the SQL query like select name from tablename;
@usmankhawar888
@usmankhawar888 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 жыл бұрын
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))
@justnow7263
@justnow7263 4 жыл бұрын
Please I need little bit explanation, what can i do this api or what he can do.
@pankajs271178
@pankajs271178 3 жыл бұрын
Accept this data in any frontend JS library. These API's are especially meant for asynchronus data extraction / posting
@gabasanjeev
@gabasanjeev 3 жыл бұрын
Thanks a lot Sir no words to express my gratitude!!!
@CodesEasy
@CodesEasy 3 жыл бұрын
Most welcome
@sannsantiago7425
@sannsantiago7425 3 жыл бұрын
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
@aritrochakraborty8122
@aritrochakraborty8122 4 жыл бұрын
sir its not showing any output, when I opened it in localhost.... can you please help me..??
@Pankajsingh-fo6tu
@Pankajsingh-fo6tu 3 жыл бұрын
Goto localhost/yourFileName/api.php
@mulhamalamry
@mulhamalamry Жыл бұрын
how to do a post rquest?
@CodesEasy
@CodesEasy Жыл бұрын
Check this. kzbin.info/www/bejne/eZuoiKeXj7xoec0
@mulhamalamry
@mulhamalamry Жыл бұрын
@@CodesEasy i want to do it in javascript
@CodesEasy
@CodesEasy Жыл бұрын
kzbin.info/www/bejne/foDCmJelq9SEg7s for js
@mulhamalamry
@mulhamalamry Жыл бұрын
@@CodesEasy thank u
@mulhamalamry
@mulhamalamry Жыл бұрын
@@CodesEasy sub added
@chandrashekarkankanala1600
@chandrashekarkankanala1600 Жыл бұрын
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
@jayakumarmhk2486
@jayakumarmhk2486 4 жыл бұрын
Thanks alooot
@Yuh--
@Yuh-- 3 жыл бұрын
how doing this with post method?
@CodesEasy
@CodesEasy 3 жыл бұрын
This is an api creation demo
@fmohtadi99
@fmohtadi99 2 жыл бұрын
Is this API???? you've just connected mySql. Api is different :)
@CodesEasy
@CodesEasy 2 жыл бұрын
This video is mainly for connecting android to MySQL
@khadijah-tul-qubrar2371
@khadijah-tul-qubrar2371 4 жыл бұрын
Nice
@ciscop2000
@ciscop2000 2 жыл бұрын
I love you
@CodesEasy
@CodesEasy 2 жыл бұрын
❤️ Happy that it helped you.
@igu642
@igu642 4 ай бұрын
❤❤
@spiderangelo
@spiderangelo 3 жыл бұрын
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.
@arpitasaxena7533
@arpitasaxena7533 2 жыл бұрын
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.
@sjn_
@sjn_ 3 жыл бұрын
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 3 жыл бұрын
Sure. Will make tutorial on it too.
@superjp335
@superjp335 2 жыл бұрын
PDO is for object orriented programming...
@Jeff-zc6rr
@Jeff-zc6rr 2 жыл бұрын
This is not an api... lots of paid commenters.
@CodesEasy
@CodesEasy 2 жыл бұрын
It's to read from database and print in json format.
@rydercarter7035
@rydercarter7035 3 жыл бұрын
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. 👍
@augustinantony7085
@augustinantony7085 4 жыл бұрын
Wow 😍😍
Minecraft Creeper Family is back! #minecraft #funny #memes
00:26
哈莉奎因怎么变骷髅了#小丑 #shorts
00:19
好人小丑
Рет қаралды 50 МЛН
Win This Dodgeball Game or DIE…
00:36
Alan Chikin Chow
Рет қаралды 26 МЛН
АЗАРТНИК 4 |СЕЗОН 2 Серия
31:45
Inter Production
Рет қаралды 1,1 МЛН
Writing My Own Database From Scratch
42:00
Tony Saro
Рет қаралды 224 М.
REST API | How to create API with Json using PHP and MySQL
12:25
Difference Between REST API vs Web API vs SOAP API Explained
7:24
Learn with Whiteboard
Рет қаралды 207 М.
Create A Python API in 12 Minutes
12:05
Tech With Tim
Рет қаралды 638 М.
RESTful API With PHP & MySQL
44:39
Traversy Media
Рет қаралды 321 М.
Using Node.js with MySQL - CRUD | XAMPP / PhpMyAdmin
48:19
Learn JSON in 10 Minutes
12:00
Web Dev Simplified
Рет қаралды 3,2 МЛН
7 Database Paradigms
9:53
Fireship
Рет қаралды 1,6 МЛН
PHP REST API From Scratch [1] - Database & Read
32:18
Traversy Media
Рет қаралды 511 М.
Minecraft Creeper Family is back! #minecraft #funny #memes
00:26