Re: Table display Driving me Crazy!

From: Date: Sat, 15 Sep 2001 16:43:44 +0000
Subject: Re: Table display Driving me Crazy!
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-12472@lists.php.net to get a copy of this message
I figured out what was wrong...and yes, the db call was from phplib...I am making modifications to existing code and so haven't figured out all the inns and outs...what I did was just create an array from the object that was being called by the query and then addressed those array elements individually here is a sample: <? for ($l = 1; $l <= $numcols; ++$l) { if ($int_j <= $int_i){ ?> <td width="139" class="ModNo" bordercolor="#000000"><?php echo $array_sku[$int_j]; ?></td> <? } //endif $int_j++; } //endfor ...sorry if the code looks like crap but yahoo tends to truncate the width... thanks anyways! Luis --- Jason Wong <phplist@gremlins.com.hk> wrote: > > The whole block is wraped in a while > ($db->next_record()) { ...} loop > > actually. Now, I'm not sure if the next_record() > method is setting an > > internal member to the current record and > returning TRUE/FALSE for > > success, or if it's actually supposed to be > returning a row. > > It should be the former. But whatever it does, it > doesn't change the fact > that the code for displaying the 1st, 2nd and 3rd > rows are in fact > displaying a constant for each of the 5 columns. > > > I'm guessing the class is simply being mis-used. > The code is reasonably > > logical assuming next_record() is setting an > internal member variable to > > the current row... doesn't look like it is though. > > If I'm not mistaken it looks to be using the phplib > library. I believe it > *is* being used correctly but he doesn't seem to be > choosing the correct > fields to display. > > > I know with ASP/VBScript that there's a decent > performance hit when you > > jump from HTML to VbScript and back again... I > would imagine though not as > > severe the same also happens in PHP. Rather than > stop the parser, print > > out something small like a "</td>" and start the > parser back up it's > > probably better performance wise to just use the > 'echo' function (well, > > keyword, I guess echo isn't a real function, print > is though). Plus, it > > makes your code more readable without all the > <?php ?> marks everywhere. > > In this case, yes, it's preferable to use echo. But > if there are more than a > few lines of html then using echo gets tedious > pretty quickly (not mention > having to escape all the "s) :) > > regards > -- > Jason Wong > Gremlins Associates > www.gremlins.com.hk > Tel: +852-2573-5033 > Fax: +852-2573-5851 > > > __________________________________________________ Terrorist Attacks on U.S. - How can you help? Donate cash, emergency relief information http://dailynews.yahoo.com/fc/US/Emergency_Information/

« previous php.db (#12472) next »