Re: problems getting results displaying correctly

From: Date: Sat, 02 Aug 2003 03:01:29 +0000
Subject: Re: problems getting results displaying correctly
Groups: php.db 
Request: Send a blank email to php-db+get-29627@lists.php.net to get a copy of this message
> Any idea's on where to throw a echo "<br>"; ???? > put the echo "<br>"; inside the first if statement. thus each new manufacturer type is preceded by a blank line. >... >while ($manufResult = db_fetch($manufQuery)) { > > if ($thread_manufacturer != $manufResult['manufacturer']) > { > echo "<br>"; > echo "<img src=\"/{$baseURL}/Graphics/spacer.gif\" > width=\"14\" height=\"1\"><a href=\"{$baseURL}/threads/{$manufResult['manufacturer']}\">{$manufResult['ma nufacturer']}</a><br />"; > $thread_manufacturer = $manufResult['manufacturer']; > } > ... if you don't want an initial blank line you could add some code such as : $skip_blank_line = true; ... if ($skip_blank_line == true) { $skip_blank_line = false; }else { echo "<br>"; } > ----- Original Message ----- > From: "Aaron Wolski" <aaronjw@martekbiz.com> > To: <php-db@lists.php.net> > Sent: Friday, August 01, 2003 10:09 PM > Subject: [PHP-DB] problems getting results displaying correctly > > > > Hi All, > > > > I'm trying to get some code to display like: > > > > > > Manufacturer 1 > > Type 1 > > Type 2 > > Type 3 > > > > Manufacturer 2 > > Type 1 > > Type 2 > > Type 3 > > > > Manufacter 3 > > Type 1 > > Type 2 > > Type 3 > > > > > > My code is: > > > > > > <?php > > > > $manufQuery = db_query("SELECT manufacturer,type FROM kcs_threads ORDER > > BY manufacturer,type"); > > > > $thread_manufacturer = ''; > > $thread_type = ''; > > > > while ($manufResult = db_fetch($manufQuery)) { > > > > if ($thread_manufacturer != > > $manufResult['manufacturer']) > > { > > > > echo "<img > > src=\"/{$baseURL}/Graphics/spacer.gif\" width=\"14\" > > height=\"1\"><a > > > > href=\"{$baseURL}/threads/{$manufResult['manufacturer']}\">{$manufResult > > ['manufacturer']}</a><br />"; > > $thread_manufacturer = > > $manufResult['manufacturer']; > > > > } > > > > if ($thread_type != $manufResult['type']) > > { > > > > echo "<img > > src=\"{$baseURL}/Graphics/spacer.gif\" width=\"20\" > > height=\"1\"><a > > > > href=\"{$baseURL}/designers/".$sort."/".$manufResult['type']."\"><font > > > > class=\"catalogueSubCatLink\">{$manufResult['type']}</font></a><br>\n"; > > $thread_type = $manufResult['type']; > > > > } > > > > } > > > > ?> > > > > Right now it is displaying like: > > > > Manufacturer 1 > > Type 1 > > Type 2 > > Type 3 > > Manufacturer 2 > > Type 1 > > Type 2 > > Type 3 > > Manufacter 3 > > Type 1 > > Type 2 > > Type 3 > > > > Any idea's on where to throw a echo "<br>"; ???? > > > > I've tried within the while loop, after it, within the if() statements > > and outside them. Nothing seems to work. > > > > Any idea's? > > > > Thanks much. > > > > Aaron > > >

« previous php.db (#29627) next »