On Sat, 28 Apr 2001, Adrian D'Costa wrote:

> hi,
> 
> I have listed the code below.  I have the below table:
> | id       | int(11)     |      | PRI |         | auto_increment |
> | operator | varchar(30) |      |     |         |                |
> | email    | varchar(35) | YES  |     |         |                |
> | url      | varchar(50) | YES  |     |         |                |
> 
> I want the operator field to be listed out in four columns and each row to
> have alternate colours.  I am able to get it to come out in four columns
> but not the color.  Where am I wrong?
> 
> <?php
> require("common.php");
> require 'functions.php';
> 
> $searchStmt = "select * from toperator order by operator" ;
> 
> 
> // connect to the db
> 
> if (!($link = mysql_pconnect($db_server, $db_login, $db_passwd))){
>    DisplayErrMsg(sprintf("internal error %d:%s\n",
>       mysql_errno(), mysql_error()));
>    exit() ;
> }
> 
> // Selct the db
> 
> if (!mysql_select_db($db, $link)) {
>    DisplayErrMsg(sprintf("Error in selecting %s db", $db)) ;
>    DisplayErrMsg(sprintf("error:%d %s", mysql_error($link),
> mysql_error($link))) ;
>    exit();
> }
> // Execute the Statement
> if (!($result = mysql_query($searchStmt, $link))) {
>    DisplayErrMsg(sprintf("Error in executing %s stmt", $searchStmt));
>    DisplayErrMsg(sprintf("error:%d %s", mysql_errno($link),
> mysql_error($link)));
>    exit();
> }
> 
> $num = mysql_numrows($result);
> include("header.php");
> ?>
> <body bgcolor=white>
> <center>
> <table border=0 width=75% cellpadding=2 cellspacing=3>
> 
> <?php
> $i=0;
> $t=0;
> $count=0;
> echo $cfgBgcolorOne;
> echo $cfgBgcolorTwo;
> $bgcolor = $cfgBgcolorOne;
> 
> echo("<tr bgcolor=$bgcolor>");
> while($row=mysql_fetch_object($result)) {
>             $i % 2  ? 0: $bgcolor = $cfgBgcolorTwo;
>             $i++;
> 
> 
> if($count % 4==0) {
> echo("</tr>");
> echo("<tr bgcolor=$bgcolor>");
> echo $bgcolor;
> }
> 
> $count++;
> ?>
>       <td><font face=Arial size=2 color=000000><B><?php echo
> $row->operator;?></B></font></td>
> <?php
> if($count % 4==0) {
> echo("</tr>");
> }
> }
> 
> ?>
> 
> </table></center>
> while($row=mysql_fetch_object($result)) {
>             $i % 2  ? 0: $bgcolor = $cfgBgcolorTwo;
>             $i++;
> 
> 
> if($count % 4==0) {
> echo("</tr>");
> echo("<tr bgcolor=$bgcolor>");
> echo $bgcolor;
> }
> 
> $count++;
> ?>
>       <td><font face=Arial size=2 color=000000><B><?php echo
> $row->operator;?></B></font></td>
> <?php
> if($count % 4==0) {
> echo("</tr>");
> }
> }
> 
> ?>
> 
> </table></center>
> <?php
> include("footer.php");
> ?>
> 
> TIA
> 
> Adrian
> 
> 


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

Reply via email to