Ajax Tutorial: How to Create Ajax Search Using PHP jQuery and MYSQL
This tutorial shows how to create simple and attractive Ajax based search using PHP, jQuery, MySQL and Ajax.
Table Structure:
1 2 3 4 5 6 | CREATE TABLE `search` ( `id` int(11) NOT NULL auto_increment, `text` varchar(255) NOT NULL, `link` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) |
Javascript Code:
1 2 3 4 5 6 7 8 | $(".searchBtn").click(function(){ //show the loading bar showLoader(); $('#sub_cont').fadeIn(1500); $("#content #sub_cont").load("search.php?val=" + $("#search").val(), hideLoader()); }); |
HTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <div class="textBox"> <input type="text" value="" maxlength="100" name="searchBox" id="search"> <div class="searchBtn"> </div> </div> <br clear="all" /> <div id="content"> <div class="search-background"> <label><img src="loader.gif" alt="" /></label> </div> <div id="sub_cont"> </div> </div> |
PHP Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | include("dbcon.php"); $rec = $_REQUEST['val']; //get table contents if($_REQUEST['val']) { $sql = "select * from search where text like '%$rec%'"; } else { $sql = "select * from search "; } $rsd = mysql_query($sql); $total = mysql_num_rows($rsd); |
Who I Am

Zeeshan Rasool
Software Engineer - PHP
Lahore - Pakistan
zeeshan(@)99points.info
Skype: zeeshan-rasool
gTalk: zishan.rasool85
Categories
- AJAX (37)
- Codeigniter (16)
- CSS (16)
- Facebook (11)
- Joomla (1)
- JQuery (53)
- Miscellaneous (4)
- Mootools (1)
- MySQL (6)
- PHP (60)
- SEO (2)
- Technology (6)
- Tutorials (15)
- Twitter (2)
- Web Design (23)
- Web Development (57)
- WordPress (2)
Tags
99points
adobe
AJAX
ajax pagination
ajax rating
ajax tutorial
ajax voting system
captcha
Codeigniter
codeigniter 2.0
codeigniter recaptcha
CSS
css tutorials
dreamweaver cs5
Facebook
facebox
farmville
ffmpeg
flv
google api
hacking
Joomla
JQuery
JQuery Gallery
JQuery menus
Jquery tutorial
mafia war
Mootools
MySQL
pagination
Payment
PHP
php curl
recaptcha
RSS Feed
SEO
simplepie
socail networking
ssl
Tutorials
Twitter
wall script
Web
XSS
youtube
Comments
- ZeeShaN on Facebook Wall Script Clone with JQuery and PHP: Personal Project BETA Version 2.0
- 20 + Fresh jQuery Image Gallery/Slider Plugins and Tutorials Worth a Look | free on JQuery Based Flipped Image Gallery with Bounce Effects
- 20 + Fresh jQuery Image Gallery/Slider Plugins and Tutorials Worth a Look | free on Fresh JQuery Image Gallery with Captions and Auto Play/Pause Rotation
- 25 Cool and Helpful jQuery Plugins/Tutorials For Your Next Project | free on jQuery Tutorial: Create jQuery and CSS based Awesome navigation.
- 25 Cool and Helpful jQuery Plugins/Tutorials For Your Next Project | free on Ajax Tutorial: How to Create Ajax Search Using PHP jQuery and MYSQL
ZeeShaN







[...] 3.How to Create Ajax Search Using PHP jQuery and MYSQL This tutorial shows how to create simple and attractive Ajax based search using PHP, jQuery, MySQL and Ajax. [...]
how to create search engine script in php pls help me…
thanks. fix error
nice
[...] Ajax Tutorial: How to Create Ajax Search Using PHP jQuery and MYSQL [...]
[...] http://www.ibm.com/developerworks/opensource/library/os-php-jquery-ajax/ http://www.99points.info/2010/06/ajax-tutorial-how-to-create-ajax-search-using-php-jquery-and-mysql/ [...]
hi i need to know how url change and result will show one the same page without refreshing like google
I want the admin of my site to have the ability to delete users from my database. In order to do that I want to make a search by user name. The query results (user info) I want to display in a table where a delete option will be available.Admin will press the delete option (which will be a link to another page) and the specific user will be deleted from the database. I have done the changes but it seemed that the search never happens. I don’t know if the problem is the greek characters I used in my database data or I have missed something. I can send you my code to check it if you want.
Thanks a lot for your quick response!
I really appreciate it!
yea I forgot to add. good
Hello,
Sorry, I could not understand your issue, can you make it more specific please.
Thanks !