0

Hi all,

I want to develop a search functionality in my php website. My requirement is as below..

I have a text field for entering the required key word.After enter my search keyword and hit the "search" button, it should list all the data with respect to the entered item.

Eg:If i enter the word "hospital" in the text field and hit search button, then it should list the names of all hospitals in that country..
How can I implement it..

Thanks in advance
AlAyam

4
Contributors
4
Replies
15
Views
4 Years
Discussion Span
Last Post by OsaMasw
0

If that is not what you want to implement, then try creating yours, and then let us know where you get stuck ...

0

THIS is the simple way to search and you can develope it

<?php
$word = $_POST['NAME_OF_TEXTBOX']; // dont forget to protect those inputs
$sql = "SELECT * FROM YOUR_DATABASE WHERE YOUR_COLOUMN LIKE '%".$word."%' LIMIT ANY_NUMBER";
$run = mysql_query($sql);
if (mysql_num_rows($run) > 0 ) {
while ($data = mysql_fetch_assoc($run)) {
echo $data['YOUR_COLOUMN'];
}
}else {
echo "No result";
}
?>

Edited by OsaMasw

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.