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:
? for ($l = 1; $l = $numcols; ++$l) { 
if ($int_j = $int_i){ ? 
td width=139 class=ModNo
bordercolor=#00?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 [EMAIL PROTECTED] 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/

-- 
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-DB] Table display Driving me Crazy!

2001-09-13 Thread Adv. Systems Design

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

table width=100% border=1 cellspacing=0
cellpadding=0 bgcolor=#00
?php
  $db-query($list);
  while ($db-next_record()) { ? 
tr bgcolor=#66
?php $numcols = 5;
for ($l = 1; $l = $numcols; ++$l) {?
  td width=139 class=ModNo
bordercolor=#00?php echo
$db-f(product_sku); ?/td
?php } ?
/tr
tr bgcolor=#ECEF7A
?php for ($l = 1; $l = $numcols; ++$l) { ?
  td height=80 bordercolor=#00 
div align=centerA HREF=?php
$sess-purl(URL . ?page=$flypageproduct_id= . 
  $db-f(product_id) . category_id= .
$db-f(category_id)); ?
?php
$ps_product-show_image($db-f(product_thumb_image),);
?/A
/div
  /td
?php } ?
/tr
tr bgcolor=#C9C62D bordercolor=#C9C62D 
?php for ($l = 1; $l = $numcols; ++$l) { ?
  td class=prodName?php
$db-p(product_name); ?/td
?php } ?
/tr
?php } ?
/table

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]




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

table width=100% border=1 cellspacing=0
cellpadding=0 bgcolor=#00
?php
  $db-query($list);
  while ($db-next_record()) { ? 
tr bgcolor=#66
?php $numcols = 5;
for ($l = 1; $l = $numcols; ++$l) {?
  td width=139 class=ModNo
bordercolor=#00?php echo
$db-f(product_sku); ?/td
?php } ?
/tr
tr bgcolor=#ECEF7A
?php for ($l = 1; $l = $numcols; ++$l) { ?
  td height=80 bordercolor=#00 
div align=centerA HREF=?php
$sess-purl(URL . ?page=$flypageproduct_id= . 
  $db-f(product_id) . category_id= .
$db-f(category_id)); ?
?php
$ps_product-show_image($db-f(product_thumb_image),);
?/A
/div
  /td
?php } ?
/tr
tr bgcolor=#C9C62D bordercolor=#C9C62D 
?php for ($l = 1; $l = $numcols; ++$l) { ?
  td class=prodName?php
$db-p(product_name); ?/td
?php } ?
/tr
?php } ?
/table

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]




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

 table width=100% border=1 cellspacing=0
 cellpadding=0 bgcolor=#00
 ?php
   $db-query($list);
   while ($db-next_record()) { ?
 tr bgcolor=#66
 ?php $numcols = 5;
 for ($l = 1; $l = $numcols; ++$l) {?
   td width=139 class=ModNo
 bordercolor=#00?php echo
 $db-f(product_sku); ?/td
 ?php } ?
 /tr
 tr bgcolor=#ECEF7A
 ?php for ($l = 1; $l = $numcols; ++$l) { ?
   td height=80 bordercolor=#00
 div align=centerA HREF=?php
 $sess-purl(URL . ?page=$flypageproduct_id= .
   $db-f(product_id) . category_id= .
 $db-f(category_id)); ?
 ?php
 $ps_product-show_image($db-f(product_thumb_image),);
 ?/A
 /div
   /td
 ?php } ?
 /tr
 tr bgcolor=#C9C62D bordercolor=#C9C62D
 ?php for ($l = 1; $l = $numcols; ++$l) { ?
   td class=prodName?php
 $db-p(product_name); ?/td
 ?php } ?
 /tr
 ?php } ?
 /table

 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!):

 ?php
   $numcols = 5;
   for ($l = 1; $l = $numcols; ++$l) {
 ?
   td width=139 class=ModNo bordercolor=#00
 ?php
   echo $db-f(product_sku);
 ?
   /td
 ?php
   }
 ?


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 ?php ? to
enclose php code looks cleaner.

For example the above can be rewritten as:

 ? $numcols = 5; ?
 ? for ($l = 1; $l = $numcols; ++$l): ?
 td width=139 class=ModNo bordercolor=#00
 ? echo $db-f(product_sku); ?
 /td
 ? endfor; ?


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 Justin Buist

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

  ?php
$numcols = 5;
for ($l = 1; $l = $numcols; ++$l) {
  ?
td width=139 class=ModNo bordercolor=#00
  ?php
echo $db-f(product_sku);
  ?
/td
  ?php
}
  ?


 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 /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.

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

 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




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