John D
02-27-2003, 02:09 PM
Hello,
I had someone working on a script for my new site to allow users to search through a database.
I will be doing a database of hosts and adding details on each ie. space, bandwidth, php etc.
I want users to have the ability to search the database for hosts which match their requirements,
Do you know any any scripts which allow this?
I would have to be able to change a lot on it which may be a problem..
Thanks,
John
Jordan at vS
02-27-2003, 05:50 PM
i could make a script that could do this for you for around $15.
Otherwise try hotscripts.com
TowerHost
02-27-2003, 11:06 PM
wanabehost -
If you have a custom database already made, I would hire someone to code this for you rather than trying to use a pre-made script. It is a relatively simple job and shouldn't take more than a few hours to complete.
Kaliber
02-28-2003, 10:11 AM
easy,
<form action="<? print $PHP_SELF; ?>" method="POST">
Search For: <input type=text value="srch" value="<? print $srch; ?>"><br>
<input type=submit value="Search"></form><p><b>Results</b><br>
<?php
$db="";
$u="";
$p="";
if (!empty($search)) {
$c = mysql_connect("localhost", $u, $p );
if ( !$c ) die ( "Connection Error" );
mysql_select_db( $db, $c ) or die ( "Could not connect to DB" );
$q = mysql_query("SELECT * FROM table WHERE field='$srch' LIMIT 10");
while ($row = mysql_fetch_object($q)) {
echo "$row->word <br>";
}
mysql_close();
?>
Should work.
Icheb
02-28-2003, 05:37 PM
Kaliber:
You pass variables untested to the db.
"WHERE field='$srch'" is a good laugh for me.
Kaliber
02-28-2003, 08:05 PM
woops
<?php
$db="";
$u="";
$p="";
if (!empty($srch)) {
$c = mysql_connect("localhost", $u, $p );
if ( !$c ) die ( "Connection Error" );
mysql_select_db( $db, $c ) or die ( "Could not connect to DB" );
$q = mysql_query("SELECT * FROM table WHERE field='$srch' LIMIT 10");
while ($row = mysql_fetch_object($q)) {
echo "$row->word <br>";
}
mysql_close();
?>
What is your problem?
John D
03-01-2003, 08:39 AM
Hi,
I have got it all sorted now,
Thanks for the help everyone :)
John
gmarik
03-01-2003, 01:10 PM
If you would want a more advanced search script, let me know, I've got one on my mind.