This will allow you to search you records in your database. It uses the LIKE string and looks for anything related and prints it. For example if you search for the letter "m" it would print all data fitting the catagory you gave it with the letter "m". [ the llama ] Update made 0a5-25-2001......the search string was not searchinng the entire fileds, only the first word of each record....the change had to do with the LIKE and % strings.....
By : llama
###################################################################### # The LLama # =========================== # # Copyright (c) 2000 by The LLama (scripts@projectgis.org) # # Search Records In MYSQL # # This program is free software. ######################################################################
//This is the form I use to initiate the script (call this find.php) <form method=post action="search.php">
//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%' ");
//The end result prints the username / passwd / firstname / lastname / ID / email //you will have to change these fields also to fit your needs ?>
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.