I am attempting to generate a query statement (using PHP) that is generated
based on user input from 2 sets of checkboxes.  You can see a
barely-functioning version at this URL:

http://www.nobleaccord.com/view/view.php

The top part of the form just shows what the query statement looks like.
The bottom form actually shows something (it's a much much simpler query).  

Anyway, my goal is to be able to make a complex filter for the query so that
the items I want to see are shown.  Here's the code for the form process:

<h3>The results of your query are as follows:</h3>
<table border=0 cellspacing=0 cellpadding=0 align=center width=90%>
        <tr>
                <td>
<?PHP

$connect = mysql_connect ($host, $user, $pass) or die("Unable to connect to
database");

@mysql_select_db("nobleacc_items",$connect) or die ("Unable to select data
table");

if ($submit1)
{

$filter1 = " cat =\"";
$filter1 .= implode("\",\"",$category);
$filter1 .= " \" ";

$filter2 = " sub =\"";
$filter2 .= implode("\",\"", $subcat);
$filter2 .= "\"";

$query = "SELECT item_pic, cat, sub, item_name, username FROM item_name
WHERE $filter1 AND ($filter2)";

$result = mysql_query ($query, $connect);

print "<b>The first filter is:</b>  $filter1<br>";
print "<b>The second filter is:</b>  $filter2<br>";
print "<b>The query you just built is:</b>  $query<br>";
?>


My question is this...how do I make this work better?  I am getting errors
as it stands right now so I am pretty sure that the query that is built
isn't correct.

Thanks,

Jon Trelfa

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to