Re: SELECT & FETCH ARRAY

From: Date: Thu, 14 Sep 2000 16:43:02 +0000
Subject: Re: SELECT & FETCH ARRAY
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-2656@lists.php.net to get a copy of this message
Thanks everyone I shall have a bash at getting all your recommendations into action this evening. I am extremely grateful to you all for your assistance. On a final note, is everyone getting two of the same message from the list? I seem to be getting double bubble of everything at the moment except for my salary.... Thanks, Karl Karl Phillipson wrote: > 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>"); > } > > ?> > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > For additional commands, e-mail: php-windows-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.windows (#2656) next »