----- Original Message -----
Sent: Tuesday, February 24, 2004 2:15 AM
Subject: Re: MySql and php

thanx alot for ur reply , i think better to send my script to u .In third collom , there is two different status . I want to highlight those with two different colors.There is to be satisfied some simple condition , plz help
 
 
thanx
curlys
 
<?php
    /* Connecting, selecting database */
    $link = mysql_connect("localhost", "root", "*****")
        or die("Could not connect");
    /*print "Connected successfully";*/
    mysql_select_db("smsc") or die("Could not select database");

    /* Performing SQL query */
    $query = "SELECT * FROM ServiceStatus";
    $result = mysql_query($query) or die("Query failed");

    /* Printing results in HTML */
    print "<table>\n";
    while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
        print "\t<tr>\n";
        foreach ($line as $col_value) {
            print "\t\t<td>$col_value</td>\n";
        }
        print "\t</tr>\n";
    }
    print "</table>\n";

    /* Free resultset */
    mysql_free_result($result);

    /* Closing connection */
    mysql_close($link);
?>
 
 
----- Original Message -----
From: Eve Atley
Sent: Tuesday, February 24, 2004 4:52 AM
Subject: RE: MySql and php

You want the rows to alternate colors in the table, you mean? That's easy.
 
 <? 
function alternate_2colors($color_1, $color_2, $cpt)
{
 $colors = ($cpt % 2) ? $color_1 : $color_2;
 return $colors;
}
 
  while ($row = mysql_fetch_array($result_jobslisting, MYSQL_ASSOC)) {
   $nb += 1;
   $colors = alternate_2colors('#C0C0C0', '#FFFFFF', $nb); 
 ?> 

   <tr bgcolor="<?php echo $colors; ?>">
  <td width="39%">
    
html content here

  </td>
  </tr>
 <?
  }
 ?>

------------------------
Eve Atley
WOW Corporation LLC.
555 North Bell Ave.
Carnegie, PA 15106
TEL: 412-278-1838
CELL: 412-716-6060
 

-----Original Message-----
From: CurlyBraces Technologies ( Pvt ) Ltd [mailto:[EMAIL PROTECTED]
Sent: Monday, February 23, 2004 10:05 AM
To: [EMAIL PROTECTED]
Subject: MySql and php

hi ,
i have a problem with Mysql Vs php .. Can somebody help me to sort out this problem ?
 
I wrote a php script to connet mysql data base and get some data from some table of the database. It works well ..
 
1    data1    data2
5    ccc        xcx
3    aaa    123
2    klkl    opop
4    opop    pop
 
I want do the sort for the fields while its showing from the web. and in the third data field i want to add some colors while its running in the html .
 
can some body help me to do the scripting plz ?
 
thanx in advace
 
curlys
-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to