SELECT & FETCH ARRAY

From: Date: Thu, 14 Sep 2000 14:00:28 +0000
Subject: SELECT & FETCH ARRAY
Groups: php.windows 
Request: Send a blank email to php-windows+get-2649@lists.php.net to get a copy of this message
Okay PHP gurus I have a problem and I am hoping someone can help me with it. I have the script below connecting to a db to extract info based on a particular town($Town) and then on the type ($Grade) of accommodation available in that town. What happens is that if I select from my drop down menus the Town and the Grade of accommodation I get what I want. However, if I neglect to specify either of the two, that being Town or Grade I get nothing, what I would like is all in either category to be displayed if one of the select options is NULL. On a final note, this is probably a really crap question - ( I ask them on occasion) - but I seem to have trouble containing a returned table within say a defined area of 600 px width. Even whn I specify a table width it always overides it. The table always stretches to 100% of a given area. It works within frames where I can specify the master frame width but I am trying to avoid the use of frames. I thank you in advance for what is more than likely easy answers to some of you out there. Regards, Karl <? $cursor = mysql_query("SELECT * FROM Accommodation WHERE Town = '$Town' AND Grade = '$Grade'"); if (!$cursor) { echo("<H3>MySQL error: " . mysql_error() . "</H3>"); exit(); } while ( $row = mysql_fetch_array($cursor) ) { print("<TR><TD><b>" . $row["Grade"] . "</b><BR><BR></TD></TR>"); print("<TR><TD><b>" . $row["Establishment"] . "</b><BR></TD></TR>"); print("<TR><TD>" . $row["Town"] . "<BR></TD></TR>"); print ("<HR>"); } ?>

« previous php.windows (#2649) next »