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.
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.
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 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
@@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.
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
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.
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?
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
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 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 @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))
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
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.
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.
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. 👍
A video should look likes that a new comer can learn without Instructor. You did the perfect job for a new learner.
Happy to hear that.
Luckily found this tutorial, I need to create a dummy API for my front end page, Great tutorial!
Happy that it helped you
Thanks sir, This task has not been done for many hours. A very good video according to my task.
Most welcome
Thank you so much, still relevant in 2024
Happy that you liked it
Great tutorial. Simple and ez to understand. Many tutorial out there are using classes. It make me confused 😵
Glad it was helpful!
aahhh thanks you guyz completely wrecked my 2 hour , in the line no 5 there `data` should bein back thick 😤😤😤😤
What is the error you are facing, explain it so we could help you 🙂
@@CodesEasy I resolved it , without the backtick the data was not visible 🗿
Very informative & to the point
Helped me a lot in making an API that I want to use with ReactJS
Happy that the video helped you
After a year its helped me, thanks a lot sir 😊
Happy that it helped you
Thank you so much Sir, it help me a lot! Still good in 2024
Glad it helped!
It's really good. Please continue this video further.
Happy to hear that
Excellent explanation, workd prettu fine, thanks a lot !!
Happy that it helped you
Really Easy to understand, good work
Happy that it helped you
bravo..thanks..it was WONDERFUL
Happy that you liked it
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.
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.
This is really simple... waiting for C (R = done) U D parts. Thanks !
How did you connect the .php file to the sql database? I am new to this, i need bit explanation.
Well explained.. thanks..hoping for more videos on php
Sure 👍
Very helpful vdieo,
Thanks
Glad it was helpful!
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 :)
Sure, we will be doing something soon.
Fantastic!
@@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
Thank you dude. It helped me a lot
Glad it helped
GREAT VIDEO Short and To The Point
Glad it was helpful!
Easy Pissy, Thanks. Subscribed
👍
Bro i have my own db idk how to access it in android studio can you help me
why dont u use the prepared statement to avoid sql injection in your database??
In this video we are not inserting any data so there was no need, also it's for beginners.
@@CodesEasy right
If I want to display 6 tables, and make some queries, I have to create multiple files or?
You can do all in one file too it depends on your needs
@@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.
Best video, short and up to the point.
Happy that it helped you
Thanks
It help me a lot
Glad it helped you.
Thank a lot for saving time!!!
Happy that it helped you
please make a video on information about MySql, Sqlite what is the need and difference between
and what is php plugins?
Sure. 👍
do you have an actual tutorial that connects to a thrid party api
Third party api integration is different, not like this. What api you are implementing
@@CodesEasy Clio, Bigcommerce, Shopify, Mailchimp something like that
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
Thank you so much, dear :)
Happy that it helped you
Now 2024 wait bro after 3 years my baby come to learn your code
All the best👍
Thanks for your tutorial very easy to understand.
Happy that you liked it
this method support 10 million data of mysql? how to search for specific data in the url
Thanks a lot broo!
Happy that you liked it
when I run the file, it says "Not found". why?
Local host address will be wrong
@@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
How to retrieve this Jeson data in android studio .???
@@CodesEasy ok , I done data insert ,update , delete successfully . With some additional. Code in yours 👍
What to do if we want to fetch pdf data from website in android ap.please respond
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.
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?
Just use data that are necessary, select necessary data and display.
@@CodesEasy thanks!
OMG thank you very much!!!
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
It's not json_decode() it's json_encode()
@@CodesEasy thank you sir i solved it now its working
how doing this with post method?
This is an api creation demo
Do u have a tutorial on how to get the data on two different database using API?
You will have to change the connected database and then to the operation on second db.
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.
If you are referring to android apps, yes you need APIs for making everything easy and fast.
Fatal error: Cannot use temporary expression in write context in C:\xampp\htdocs\
Some error with your scripts.
i was looking for creating api, now i got with simple concept,thank you,but how to embed from libraries and create
There are other videos on our channel check them
thank you bro
Happy that you liked it
Thanks a lot Sir no words to express my gratitude!!!
Most welcome
how to do a post rquest?
Check this. ua-cam.com/video/CjEWtaZW5Ck/v-deo.html
@@CodesEasy i want to do it in javascript
ua-cam.com/video/HO_gdovoQMY/v-deo.html for js
@@CodesEasy thank u
@@CodesEasy sub added
Thank you !
Happy that you liked it
How can I create a very secure API?
Thanks dear sir
Happy that you liked it
Please I need little bit explanation, what can i do this api or what he can do.
Accept this data in any frontend JS library. These API's are especially meant for asynchronus data extraction / posting
Please make a video and attached this php code with android studio and fetch data in app
All the necessary files are there in the description.
Would you help me with a small project, that is to link an api to another?! How much would you charge me?
Sure, contact whatsapp.codeseasy.com
Wow, Thank You !
Just One Suggestion, Please Provide Source Code In Description For Easy Access. Thank You
sir its not showing any output, when I opened it in localhost....
can you please help me..??
Goto localhost/yourFileName/api.php
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
Yes, just change the SQL query like select name from tablename;
@@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
Since you have that much data, you have to use an algorithmic approach to search, to get better speed.
Right now your SQL query can be like select name from table where name like 'Codes%';
Now this returns everything that starts with codes
@@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))
Great❤
Happy that you liked the video
Perfect
Thanks
Happy to hear
where is the code
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
thank you
Happy that you liked it
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.
You can implement basic auth for that.
Is this API???? you've just connected mySql. Api is different :)
This video is mainly for connecting android to MySQL
Ok seriously who uses mysqli in 2020? Why don't the tutorial makers ever encourage their viewers to use PDO with anonymous query parameters?
Sure. Will make tutorial on it too.
PDO is for object orriented programming...
Why this is called API? This is just querying a MySQL database!!!!!
It's a very simple and basic level, we use the output on mobile apps.
This is not an api... lots of paid commenters.
It's to read from database and print in json format.
Bro this is not a API its just a Database query
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
What where you looking for. We would like to make a video on that too if you could explain.
Thanks alooot
Nice
I love you
❤️ Happy that it helped you.
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.
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. 👍
❤❤
Wow 😍😍