Hi. I've been looking for answers around the net and havent found what I need, so hope someone here can help me out.

I have a recipe/cookbook program and database on a web site. I want to be able to let users search the database in 3 different ways:

1. Show all recipes
2. Show all recipes in a category by selecting from a drop down menu
3. Search by keyword in from either all recipes, or recipes in a certain category.

The way it is currently set up, there are 3 php search scripts I'm using.

"results.php" gives all recipes in the database <SELECT * FROM recipes ORDER BY recipename ASC>.

"search.php" searches by the drop down menu category, the select name=list <SELECT * FROM recipes WHERE category LIKE '%$list%' ORDER BY recipename ASC">.

"search2.php" does a keyword search, keyword name=ingredients
<SELECT * FROM recipes WHERE ingredients LIKE '%$ingredients%'>.

There are 3 because I haven't been able to find out how to put them all together. Basically, they all work, but is there anyway to combine all this into one script to do the queries? The mySql table is set up as follows;

id, firstname, email, recipename, category, preptime, cooktime, servings, ingredients, directions.

This is the "search.php" I've been using, in case it helps someone to see what i'm working on.

.td1 {
font: bold 10pt Tahoma;
background: #b0acb0;
.td2 {
font: bold 10pt Tahoma;
background: #a098a0;
.trhead {
font: bold 11pt Tahoma;
background: #00689e;
color: #FFFFFF;


mysql_pconnect("xxxxxx", "xxxxxx", "xxxxxx") or die("error connecting to database");
mysql_select_db("xxxxxx") or die("error selecting database");

$rs = mysql_query("SELECT * FROM recipes WHERE category LIKE '%$list%' ORDER BY recipename ASC");

// create an array holding the classes you want to switch between
// a counter to keep track of which class is currently being used
$num = mysql_num_rows($rs);
$i = 0;

echo "<TABLE style=\"border: double\" width=550 align=center cellpadding=4 cellspacing=0>";
echo "<tr class=trhead>";
echo "<td width=550 height=40 align=center>Our Recipes For The Category That You Selected</td>";

echo "</tr>";

while ($i < $num):
$recipename = mysql_result($rs,$i,"recipename");
$firstname = mysql_result($rs,$i,"firstname");
$email = mysql_result($rs,$i,"email");
$category = mysql_result($rs,$i,"category");
$preptime = mysql_result($rs,$i,"preptime");
$cooktime = mysql_result($rs,$i,"cooktime");
$servings = mysql_result($rs,$i,"servings");
$ingredients = mysql_result($rs,$i,"ingredients");
$directions = mysql_result($rs,$i,"directions");

// access the value in the array associated with the key equal to the counter and print it in the <tr> bg
echo "<tr class=" . $classes[$classifier] .">";
echo "<td><font size=3> $recipename</font> <p>
This recipe was submitted by: $firstname <br>
$firstname's Email: $email <br>
This recipe is in the category of $category <br>
Appx. preparation time is $preptime <br>
Appx. cooking time is $cooktime <br>
This recipe makes @ $servings servings<p>
The ingredients you will need are as follows:<p>$ingredients<p>
Here is how you make this recipe<p>$directions <br><hr size=1 width=50%> </td>";

echo "</tr>";

// increment the counter and mod it by 2 to effectively alternate between two numbers

This searches by category, and lists entire recipes with alternating colored rows.

I have tried multiple <form action=blahblah> tags, which didnt work, only one query would work properly at a time. I have tried "ifset" type of inserts in the search scripts, but nothing worked. So in a nutshell, can this all be put into one search php script? Can it also be paginated? (I couldn't get thet to work, either). And what about a keyword highlight when the keyword option is used? (No luck with that one either).

As I said, the 3 work, but I'd like to clean it up and look a little more professional, if possible. Thnx for any help you can give me.

Also, you can check out what I've got by going to http://womenintrucking.net/cookbook/cookbook.html