Web Design Forum HTML CSS JavaScript PHP Graphic Design SEO forum
How can I put search option in my website?? - Printable Version

+- Web Design Forum HTML CSS JavaScript PHP Graphic Design SEO forum (http://www.webdesignforum.com.au)
+-- Forum: Web and Graphic Design (/forumdisplay.php?fid=1)
+--- Forum: Programming (/forumdisplay.php?fid=10)
+--- Thread: How can I put search option in my website?? (/showthread.php?tid=136)



How can I put search option in my website?? - justinOrel - 01-13-2011 11:22 AM

Hey,

I am new in this section, I want to put a search option in my website,i heard about php scripts could help, but is there anyone who has already that script and share with me please...

Cheers


RE: How can I put search option in my website?? - jalicia18 - 02-02-2011 05:23 PM

(01-13-2011 11:22 AM)justinOrel Wrote:  Hey,

I am new in this section, I want to put a search option in my website,i heard about php scripts could help, but is there anyone who has already that script and share with me please...

Cheers

Table: Members
Fields: id | username | password | completename | country
Records:
1 | test | test123 | Testing | Philippines
2 | shin | shin10 | Shin Shin | India

PHP Script - Search
Quote:<?php
/* include your database connection here */
if($_GET[Search]=="Search")
{
$q = $_GET['q'];
$sql = "SELECT * FROM Members WHERE completename LIKE '%$q%' OR username LIKE '%$q%' ";
$result = mysql_query($sql);
$rows = mysql_num_rows($result);
if($rows<=0)
{
echo "No Result(s) Found";
}
else
{
while($found = mysql_fetch_array($result))
{
echo "Username: " . $found[username] . "<br>";
echo "Password: " . $found[password] . "<br>";
echo "FullName: " . $found[completename] . "<br>";
echo "Country: " . $found[country] . "<br>";
echo "<br>";
}
}
}
?>

Search Term: Shin
Quote:Username: shin
Password: shin10
Fullname: Shin Shin
Country: India

Simple Search Form
Quote:<form method="GET" action="">
Enter any keyword<br>
<input type="text" name="q" value=""><br>
<input type="submit" name="Search" value="Search">
</form>



RE: How can I put search option in my website?? - Daave - 05-11-2011 05:38 PM

The code is provided to you, I wanted to know whether it worked well or was there any issue.


RE: How can I put search option in my website?? - dianna - 07-24-2011 06:03 PM

i use this link its help me more


RE: How can I put search option in my website?? - superbwebsitedesign - 07-30-2011 05:41 AM

you can write search function in your logic. In php site smarty framework is available for ready made template which will help you put ready made functionality.


RE: How can I put search option in my website?? - anusha - 10-24-2011 06:24 PM

First you have CGI access and that perl is installed. It also installs the script remotely for you if you answer a couple of questions for it (account username and password) which saves you from the installing it yourself.

I've used it for several years and have no issues with it.


RE: How can I put search option in my website?? - websitebuildersperth - 12-27-2011 09:23 PM

the code provided is quite helpful


RE: How can I put search option in my website?? - jackkelly - 09-06-2012 10:27 PM

thanks for your useful post here good share here


RE: How can I put search option in my website?? - lennonrowen - 09-17-2012 10:11 PM

Even the WordPress native search function is inferior to having
the mighty G do your search for you.