Hi all, this is my first post and was wondering if someone can help me :D
See I have a search field with a results.php and I want to have results from multiple fields.

<form id="form1" name="form1" method="get" action="results.php">
    Search: 
    <label>
    <input type="text" name="findthis" id="findthis" />
    </label>
    <label>
    <input type="submit" name="button" id="button" value="Go" />
    </label>
  </form>

i can get only from one category with this code
results.php:

<?php
require_once("connect.php");
$mysearch = $_GET['findthis'];
$mystuff = mysql_query("SELECT product_id, product_name, furnishings_thumb, furnishings_info, lighting_info,lighting_thumb FROM Products_tbl WHERE product_name LIKE '%".$mysearch."%' ORDER BY product_name ASC");

while($row=mysql_fetch_array($mystuff)) {
print "<tr><td><img src='images/thumbs/".$row['furnishings_thumb']."' /></td><td>".$row['product_name']."</td><td>".$row['furnishings_thumb']."</td><td>".$row['furnishings_type']."</td><td><a href='furnishings_details.php?product_id=".$row['product_id']."'>more...</a></td></tr>";
}
?>

I want someone to search a product name and get results from either lighting or furnishing depending on what was searched, say couch or lamp.I am only allowed to get results with furnishings how would i be able to get results for the lightings and furnishings
thanks if anyone can help

What you can do (as one of many possible solutions) is create two arrays each containing the product names valid for furnishing and lightings and then use a conditional structure to build the final SQL.

You can use the in_array function to check if a searched product name is present in each product name array.

This way you can have different queries according to the product being searched.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.