Page 1 of 1

[SOLVED] Zebra Tables Help

Posted: Sat Oct 02, 2004 9:16 pm
by C_Calav
hi guys,

i have been following this tutorial http://www.linuxguruz.com/z.php?id=321

and it looks pretty simple. i have done some things differently, and i cant get any colour displaying. not getting any errors.

can anyone takre a look and see what im doing wrong please? any help would be great!

thanx!

Code: Select all

<?php
  $db = mysql_pconnect('xxxx', 'xxxx', 'xxxx') or die ("Could not connect to database");


  mysql_select_db('models') or die ("Could not select database!"); 

  $query = "select * from planes";
  $result = mysql_query($query);

  $num_results = mysql_num_rows($result);


  echo '<p>Number of Planes found: '.$num_results.'</p>';

  echo "<table>

  	<tr> <td> <B> Stock # </td>
  	<td> <B> Name </td>
  	<td> <B> Category </td>
  	<td> <B> Scale </td>
  	<td> <B> Length </td>
  	<td> <B> Span </td>
  	<td> <B> Price </td>
        <td> <B> Description </td> </tr>";

  for ($i=0; $i <$num_results; $i++)
  {

     if(($i % 2) == 0) { $c = "#9999CC"; } 
     else { $c = "#CCCCCC"; }
	

     $row = mysql_fetch_array($result);
     
     $P_Stock = $row['P_Stock'];
     $P_Name = $row['P_Name'];
     $P_Cat = $row['P_Cat'];
     $P_Scale = $row['P_Scale'];
     $P_Length = $row['P_Length'];
     $P_Span = $row['P_Span'];
     $P_Price = $row['P_Price'];
     $P_Desc = $row['P_Desc'];

    
     echo "<tr><td bgcolor=$c> $P_Stock </a>  </td>
     	   <td>$P_Name</td>
     	   <td> $P_Cat </td>
     	   <td> $P_Scale </td>
     	   <td> $P_Length </td>
     	   <td> $P_Span </td>
     	   <td> $P_Price </td>
     	   <td> $P_Desc </td> </tr> ";
   
  }

    echo"  </table>";
?>

Posted: Sat Oct 02, 2004 9:19 pm
by C_Calav
i got it going now i had the CSS sytle sheet overlapping the color duh!

Posted: Sat Oct 02, 2004 9:21 pm
by nigma
excellent! glad to see you worked things out :P