Monday 26 December 2022

Search using PHP & MySQL
I'm going to show you how to create a search engine for your website using PHP and MySQL. Here you will learn how.
PHP GET and POST
PHP connect to DB
SQL communicates
This is only a simple project now if get to understand it you will become to design your own search engine. FYI.... if you want some help find me at www.facebook.com/groups/tekkomunity/.
OK LET GET GO....

1. Go to your PHPMyAdmin and navigate to your database and to your main table examle: 

I want to search for title and artis only i will set my type on the title to varchar and artis to text. as you can see all colum need to set as on the screenshot if not, you will get into some issues.









2. Now that you already set all structure as follows, lets get into some codingsssssss.... Now in your root folder create a php file call index.php and fill in this code
inside body tag 
<form action="search.php" method="GET">  <input type="text" name="query" />
<input type="submit" value="Search" />
</form>
Action="search.php"  is pointing to your php that communicate to your SQL database which will do. Method="GET" you tring to infomations not POST.
and we will need input type is text that allow user to fill in some text and the name="query" that will pass the text to PHP and we also need a button type="submit" that will submit our text to PHP valu="Search" the name of the button. 

No comments:

Post a Comment