[PHP] using variable ..help

2002-08-28 Thread Remon Redika

I wanna do with my TR bgcolor trough my array 

?$mycolor = array(#E8D0E8, #F8EFF8);?
table
?php while ($row=mysql_fetch_array($result)){?
   tr bgcolor=?for($i=0;$i=count($mycolor[$i]);++$i){
  echo ($mycolor[$i]);
 }
?
tdblablabbaba/td
/tr
?
}
?
/table 


I have look my view source output my TR bgcolor , and i found this below
tr bgcolor=#E8D0E8#F8EFF8 

I want my tr bgcolor display with one by one like this below
tr bgcolor=#E8D0E8
td/td
/tr
tr bgcolor=#F8EFF8
td/td
/tr 

etc 

help please.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] using variable ..help

2002-08-28 Thread Stas Maximov

Remon,

Your code works correct, cause you coded it this way as it should go through
the array and output every element in the array into one line.
If I got your idea correctly - you probably want you rows to be of two
different colors. You may do it simplier way:
 table
 ?
$mycolor = array(#E8D0E8, #F8EFF8);
$index = 0;
while ($row=mysql_fetch_array($result)) { ?
tr bgcolor=? echo $mycolor[$index1]; ?
 tdblablabbaba/td
/tr
 ? $index++; } ?
/table

The $index1 construct will return either 0 or 1 for even and odd rows, so
the proper color will be selected.

HTH, Stas

- Original Message -
From: Remon Redika [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, August 28, 2002 2:46 PM
Subject: [PHP] using variable ..help


 I wanna do with my TR bgcolor trough my array

 ?$mycolor = array(#E8D0E8, #F8EFF8);?
 table
 ?php while ($row=mysql_fetch_array($result)){?
tr bgcolor=?for($i=0;$i=count($mycolor[$i]);++$i){
   echo ($mycolor[$i]);
  }
 ?
 tdblablabbaba/td
 /tr
 ?
 }
 ?
 /table


 I have look my view source output my TR bgcolor , and i found this below
 tr bgcolor=#E8D0E8#F8EFF8

 I want my tr bgcolor display with one by one like this below
 tr bgcolor=#E8D0E8
 td/td
 /tr
 tr bgcolor=#F8EFF8
 td/td
 /tr

 etc

 help please.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] using variable ..help

2002-08-28 Thread @ Edwin
I want my tr bgcolor display with one by one like this below
tr bgcolor="#E8D0E8"
td/td
/tr
tr bgcolor="#F8EFF8"
td/td
/tr

Try this:

/* -- from here -- */
?php

  $mycolor = array("#E8D0E8", "#F8EFF8");

  echo "table\n";
  
  foreach ($mycolor as $value) {
echo "tr bgcolor=\"$value\"\ntd/td\n/tr\n";
  }

  echo "/table\n";

?
/* -- 'til here -- */

- E

PS
See: http://www.php.net/manual/en/control-structures.foreach.php


I wanna do with my TR bgcolor trough my array

?$mycolor = array("#E8D0E8", "#F8EFF8");?
table
?php while ($row=mysql_fetch_array($result)){?
   tr bgcolor="?for($i=0;$i=count($mycolor[$i]);++$i){
  echo ("$mycolor[$i]");
 }
?"
tdblablabbaba/td
/tr
?
}
?
/table


I have look my view source output my TR bgcolor , and i found this 
below
tr bgcolor="#E8D0E8#F8EFF8""

I want my tr bgcolor display with one by one like this below
tr bgcolor="#E8D0E8"
td/td
/tr
tr bgcolor="#F8EFF8"
td/td
/tr

etc

help please.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




_
きっと見つかるあなたの新居 不動産情報は MSN 住宅で http://house.msn.co.jp/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php