Post Reply 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I put search option in my website??
02-02-2011, 05:23 PM (This post was last modified: 02-02-2011 05:24 PM by jalicia18.)
Post: #2
RE: How can I put search option in my website??
(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>

call center philippines | Outbound Call Center | Inbound Call Center
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


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

Forum Jump:


User(s) browsing this thread: 1 Guest(s)