Searching Php

//This is the form I use to initiate the script (call this find.php)

Search For:


User Name:


Password:




//search.php
//You should now this but be sure to connect to your database or this is useless. :/
if ($user == "")
{$user = '%';}
if ($passwd == "")
{$passwd = '%';}
// $user and $passwd are the two column names I used. Change this to fit your database
$result = mysql_query ("SELECT * FROM yourtable
WHERE user LIKE '%$user%'
AND passwd LIKE '%$passwd%'
");
if ($row = mysql_fetch_array($result)) {
do {
PRINT "User Name: ";
print $row["user"];
print (" ");
print ("
");
PRINT "Passwd: ";
print $row["passwd"];
print ("

");
PRINT "FirstName: ";
print $row["firstname"];
print ("

");
} while($row = mysql_fetch_array($result));
} else {print "Sorry, no records were found!";}
//The end result prints the username / passwd / firstname / lastname / ID / email
//you will have to change these fields also to fit your needs
?>