Hello,
I am a beginner and working on connecting a search bar with a database.
It is all pretty new for me and i am learning throw watching youtube videos.
I have question can i link a .PHP File like a .CSS File into my html.index File?
If not how do i connect a .php File so it affects the searchbar (input) on my html.index file?
Client <======> Server
Javascript <========> Php
Php <===========> Database
You use ajax to communicate from javascript to php.
You would need to use the value of the searchbar to php.
Then on php side,. you would do a select in database using a query like so:
SELECT * FROM accounts WHERE name like ‘%’ . $searchString . ‘% LIMIT 5’;
You will want to escape $searchString of any potential sql injection code. If you’re a total beginner this is quite a daunting task because it requires knowing 3 different languages and knowing how to connect to database with server., which implies you’ve already installed a database… preferably MYSQL.
None of this has anything to do with html/css.