This really isn't a MySQL question and should be handled by another 
list, But to answer your question (logically). You need to have the
whole string `productcategory.ID=\"$cat\"' optional, so that if your
variable `$cat' isn't populated  the string
`productcategory.ID=\"$cat\"'
isn't included, Also you should use what ever methods PHP provides to
escape the $cat string so users can't break it with " in it.



Neil Silvester wrote:
> 
> Another PHP problem has kept me up all night, scouring through my database
> books and trying everything I could think of. I am still new to the MySQL
> and PHP field, but never the lass I will not give up.
> $cat is a variable that is passed to the query from the previous page. The
> SELECT statement works faultlessly, except for the point at which no choice
> is made from the drop down on the page prior to this one. I have set a value
> of "x" to the drop down for a non selection, but am having problems
> converting that "x" value to a "%" value withing my SELECT statement.
> I am assuming that I will need an IF THEN before the SELECT, but I have
> tried several variation to no avail.
> 
> $result = mysql_query("SELECT CompetitorName
>         FROM competitor, competitorproducts, productcategory
>         WHERE competitorproducts.CompID=competitor.ID
>         AND productcategory.ID=\"$cat\"
>         AND competitorproducts.CatID=productcategory.ID"
> );
> 
> Any help would be mostly appreciated.
> Thanks.
> 
> Neil Silvester
> Webmaster / Systems Administrator
> Heat and Control Inc.
> 
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
> 
> ---------------------------------------------------------------------
> 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

---------------------------------------------------------------------
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