Where are you generating the query and fetching the row?

And what are the queries being run? 

Possibly a better way to do the first bit would be as follows:

$and = "";
if ($itemname)  {
  echo $n."&nbsp;".$name."</font>";
  $and = " and ";
if ($itemcolor)  {
  echo $and.$c."&nbsp;".$color."</font>";

(I've condensed the multiple echo statements into one to reduce the
number of lines, but this is more about the logic)

Depending on what your query is searching on and returning, you may be
able to do it in a single query.



Richard Black
Senior Developer, DataVisibility Ltd - http://www.datavisibility.com
Tel: 0141 951 3481

-----Original Message-----
Sent: 04 September 2002 15:41
To: Richard Black
Subject: Betr: RE: [PHP] question

if ($gevonden >= 1)
        echo "&nbsp;<b>The search for ";
                if ($itemname)
                echo $n;
                echo "&nbsp;";
                echo $name;
                echo "</font>";
                if ($itemcolor)
                if ($itemname)
                echo " and ";
                echo $c;
                echo "&nbsp;";
                echo $color;
                echo "</font>";
            echo " delivers the following results</b><p/>";


so the above if statements handle the same problem. 
if $itemname has a value, print $n and $name
if $itemcolor has a value, print $c and $color
if $itemcolor has a value and $itemname has a value, the following will
printed: $n $name "and" $c $color

After this if statement, a while statement is entered:

while ($myrow = mysql_fetch_row($itemname)) 
a lot of echo's

but what if, itemname is empty, but itemcolor is not. or what to do if
both have a value?!

I hope this explanes my problem more clearly!?

Dore van Hoorn.

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to