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

What do you have so far?

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

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";
}
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.