Search results...PHP
I wrote a script in PHP, but when searched brings only one set of results. How do I make it so if there is more than one result, it will display them all.
SBalan Group
http://www.sbalanprojects.com/
I wrote a script in PHP, but when searched brings only one set of results. How do I make it so if there is more than one result, it will display them all.
SBalan Group
http://www.sbalanprojects.com/
Busy posted this at 10:41 — 13th July 2006.
He has: 6,151 posts
Joined: May 2001
Are you able to show us the database query result?
Usually it's somethig like this:
$sqlquery = select * from data_table where item = "$search_term";
$sqlresult = mysql_query($sqlquery);
while($row = mysql_fetch_assoc($sqlresult))
{
//display the data here - is in a loop so just do once like so:
echo "Name = ".$row['name'];
echo "Age = ".$row['age'];
//etc
}
This will list ALL the results in the data base where item equals the search term, can use like search term or %search term% (starts or ends with it), if you want to limit the results add it to the end of the $sqlquery just before the ;
construction posted this at 09:25 — 14th July 2006.
They have: 111 posts
Joined: Jun 2006
Thanx Busy.
SBalan Group
http://www.sbalanprojects.com/
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.