Re: [PHP-DB] Table display Driving me Crazy!

2001-09-15 Thread Adv. Systems Design

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:
 
 
 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 "" 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
>  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/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Table display Driving me Crazy!

2001-09-13 Thread Jason Wong

> 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 "" 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  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




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Table display Driving me Crazy!

2001-09-13 Thread Justin Buist

> Looking at your code for the first row (I've cleaned it up a bit to make it
> readable!):
>
>  $numcols = 5;
>for ($l = 1; $l <= $numcols; ++$l) {
>  ?>
>
>  echo $db->f("product_sku");
>  ?>
>
>  }
>  ?>
>
>
> It should be pretty clear why you're getting the product just repeated 5
> times across the row.
>
> Your statement:
>echo $db->f("product_sku"); does not contain any reference to
> variables thus it's essentially a constant. As far as I can make out
> (your style of coding gives me a headache :)) the other loops suffer
> from the same problem.

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.

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.

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 "" 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  marks everywhere.

Justin Buist
Trident Technology, Inc.
4700 60th St. SW, Suite 102
Grand Rapids, MI  49512
Ph. 616.554.2700
Fx. 616.554.3331
Mo. 616.291.2612


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Table display Driving me Crazy!

2001-09-13 Thread Jason Wong

- Original Message -
From: Adv. Systems Design <[EMAIL PROTECTED]>
To: PHP List <[EMAIL PROTECTED]>
Sent: Friday, September 14, 2001 12:09 AM
Subject: [PHP-DB] Table display Driving me Crazy!


> Hello *
> trying to output mysql content into a table, but the
> table is designed to use 3 Trows to display info for
> ONE product (table also has to have 5 columns):
> row1 sku1|sku2|sku3|sku4|sku5
> row2 img1|img2|img3|img4|img5
> row3 nam1|nam2|nam3|nam4|nam5
> -
> row4 sku6|sku7|sku8|sku9|sku10
> row5 img6|img7|img8|img9|img10
> row6 nam6|nam7|nam8|nam9|nam10
> -
> etc...
> I have code that is displaying the right #of columns
> but it is simply repeating the product across the
> table...
>
>  cellpadding="0" bgcolor="#00">
>$db->query($list);
>   while ($db->next_record()) { ?>
> 
>  for ($l = 1; $l <= $numcols; ++$l) {?>
>bordercolor="#00"> $db->f("product_sku"); ?>
> 
> 
> 
> 
>   
>$db->f("product_id") . "&category_id=" .
> $db->f("category_id")); ?>">
>  $ps_product->show_image($db->f("product_thumb_image"),"");
> ?>
> 
>   
> 
> 
> 
> 
>$db->p("product_name"); ?>
> 
> 
> 
> 
>
> Anybody have any ideas how I can get this thing to
> work?!

Looking at your code for the first row (I've cleaned it up a bit to make it
readable!):

 
   
 f("product_sku");
 ?>
   
 


It should be pretty clear why you're getting the product just repeated 5
times across the row.

Your statement:
   echo $db->f("product_sku");
does not contain any reference to variables thus it's essentially a
constant.

As far as I can make out (your style of coding gives me a headache :)) the
other loops suffer from the same problem.

If you find yourself often mixing php with html then using the alternative
syntax for constructing loops makes the code simpler and clearer (see
http://www.php.net/manual/en/control-structures.for.php).

Also if your particular php setup allows using  instead of  to
enclose php code looks cleaner.

For example the above can be rewritten as:

 
 
 
 f("product_sku"); ?>
 
 


hth
--
Jason Wong
Gremlins Associates
www.gremlins.com.hk
Tel: +852-2573-5033
Fax: +852-2573-5851





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Table display Driving me Crazy!

2001-09-13 Thread Rick Emery

What does you mysql table look like?
What does your SELECT statements look like?
What does function p() do?
What does function f() do?

Need more info

-Original Message-
From: Adv. Systems Design [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 13, 2001 11:09 AM
To: PHP List
Subject: [PHP-DB] Table display Driving me Crazy!


Hello *
trying to output mysql content into a table, but the
table is designed to use 3 Trows to display info for
ONE product (table also has to have 5 columns):
row1 sku1|sku2|sku3|sku4|sku5
row2 img1|img2|img3|img4|img5
row3 nam1|nam2|nam3|nam4|nam5
-
row4 sku6|sku7|sku8|sku9|sku10
row5 img6|img7|img8|img9|img10
row6 nam6|nam7|nam8|nam9|nam10
-
etc...
I have code that is displaying the right #of columns
but it is simply repeating the product across the
table...


query($list);
  while ($db->next_record()) { ?> 


  f("product_sku"); ?>




   
f("product_id") . "&category_id=" .
$db->f("category_id")); ?>">
show_image($db->f("product_thumb_image"),"");
?>

  


 

  p("product_name"); ?>





Anybody have any ideas how I can get this thing to
work?!

Thanks

Luis

__
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]