IPB

Welcome Guest ( Log In | Register )



Tags
This content has not been tagged yet
2 Pages V  < 1 2  
Reply to this topicStart new topic

Php Search Engine Script For Mysql Database


iGuest
no avatar
Hail Caesar!
*********************
Group: Members
Posts: 5,876
Joined: 21-September 07
Member No.: 50,369



Post #11 post Dec 10 2007, 04:35 PM
It would be nice if instead of just one form field to do the searching, have more then one. Each for it's own search word. A real search rather then just keywords.

-Saeru
Go to the top of the page
+Quote Post
online
no avatar
Newbie
*
Group: Members
Posts: 4
Joined: 20-December 07
Member No.: 55,063



Post #12 post Dec 20 2007, 07:42 PM
Here is one i made 2 years ago...in your case it will be perfect

[codebox]
<?php
include("header.php");
echo '<h1>Sökning</h1>
<div class="descr">Sök efter</div>';

echo '<form action="search.php" method="get">';
echo 'Sortera efter:<br><select name="orderby">';
echo '<option value="username">User</option>';
echo '<option value="Fname">Förnamn</option>';
echo '<option value="Lname">Efternamn</option>';
echo '<option value="email">Email</option>';
echo '</select>';
echo '<br><br><br>';

echo '<table>';
echo '<tr><td><b>SÖK:</b></td></tr>';
echo '<tr><td><select name="select">';
echo '<option value="username">Username: </option>';
echo '<option value="Fname">Förnamn: </option>';
echo '<option value="Lname">Efternamn: </option>';
echo '<option value="email">Email: </option>';
echo '</select>';
echo '<input type="text" name="username" /></td></tr>';

echo '<tr><td><input type="submit" name="submit" value="Search" /></td></tr>';
echo '</table>';
echo '</form>';


$result2=$_GET['username'];
$orderby=$_GET['orderby'];
$result3=$_GET['select'];
$theres=trim($result2);
if ($theres== "")
{
echo "<br><br><p>Fyll i före du söker !</p>";
}
if($_GET['submit']=='Search'){
echo'Results for <b>'.$theres.'</b>... ';
$result80=mysql_query("SELECT COUNT(*) FROM all_users WHERE $result3 LIKE '%$theres%'");
echo 'Found <b>'.mysql_result($result80, 0).'</b> match/s<br><br>';
$result = mysql_query("SELECT * FROM all_users WHERE $result3 LIKE '%$theres%' ORDER BY '$orderby'");
$count = 0;
echo '<table align=center>';

while($row=mysql_fetch_array($result)){
if($count == 0 || $count == 4 || $count == 8 || $count == 12){ echo "<tr>";}
$count++;
echo '<td><a href="gallery.php?user='.$row['username'].'"><img src="allimages/'.$row['start_picture'].'" width="120px" height="95px" class="img" alt="'.$row['username'].','.$row['description'].'"></a><br><center>'.$row['username'].'</center></td>';
}
if($count == 28 || $count == 32 || $count == 36 || $count == 40 || $count == 44 || $count == 48){ echo "<tr>";}}
echo "</table>";
?>
<?php
include("footer.php");
echo'</div>';
?>
[/codebox]

[note=rvalkass]
Fixed code tags.
[/note]
Go to the top of the page
+Quote Post

2 Pages V  < 1 2
Reply to this topicStart new topic

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   5 Shibbeh 446 20th August 2004 - 10:04 PM
Last post by: ill
No New Posts   13 chinfo 1,198 2nd August 2004 - 03:12 AM
Last post by: X3r0X
No New Posts   1 yomi 305 15th August 2004 - 10:01 PM
Last post by: football123213
No New Posts 3 chalawanonline 359 2nd August 2004 - 02:34 PM
Last post by: Spectre
No New Posts   0 Chez 385 8th June 2006 - 12:21 AM
Last post by: Chez
No New Posts   0 Bash 650 7th August 2004 - 04:46 PM
Last post by: Bash
No New Posts   4 shadowx 1,008 23rd August 2007 - 08:23 PM
Last post by: shadowx
No New Posts   4 xmae 702 24th August 2006 - 03:21 PM
Last post by: juice
No new   32 xmod 3,633 17th April 2005 - 04:39 AM
Last post by: theoutlaws
No New Posts   2 threepach 693 19th February 2008 - 08:30 PM
Last post by: threepach


 



RSS Lo-Fi Version Time is now: 4th December 2008 - 05:18 PM