Jump to content

anyone think they can do this!!!


phpfisher

Recommended Posts

[code]<head>
<?php include_once("header.php")?>
<?php include("db.php")?>
<title><?php echo $cfg["name"];?></title>
</head>
<body>
<?php

// Get all the data from the " pp_files" table
$result = mysql_query("SELECT * FROM pp_files")
or die(mysql_error()); 
echo "<center><table border='0' width='50%'>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array($result))
{
  echo "<tr>";
  echo "<td bgcolor='#C0C0C0'>";
  echo "<a href='videos.php?id=".$row[id]."'>";
  echo "<font color='#00000' '><strong>".$row['name']."</strong><br>";
  echo $row['description']."<br>";
  echo $row['date']."<br>";
  echo $row['creator']."<br></font>";
  echo "</tr>";
}

echo "</table>";
echo "</center>"; ?>
<?php include("footer.php")?>

</body>
</html>[/code]

[code]  echo "<td bgcolor='#C0C0C0'>";[/code]

basically i want to change this colour to #CCCCCC every row

also there is a gap between each one can you remove it
Link to comment
https://forums.phpfreaks.com/topic/28855-anyone-think-they-can-do-this/
Share on other sites

[code]
<head>
<?include_once("header.php")?>
<?include("db.php")?>
<title><?=$cfg["name"];?></title>
</head>
<body>
<?php

// Get all the data from the " pp_files" table
$result = mysql_query("SELECT * FROM pp_files")
or die(mysql_error()); 
echo "<center><table border='0' width='50%'>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array($result)){
if($i==0){
  $i=1;
  $class='#C0C0C0';
}else{
  $i=0;
  $class='#CCCCCC';
}
echo "<tr>";
  echo "<td bgcolor='$class'>";
   echo "<a href='videos.php?id=".$row[id]."'>";
   echo "<font color='#00000' '><strong>".$row['name']."</strong><br>";
   echo $row['description']."<br>";
   echo $row['date']."<br>";
   echo $row['creator']."<br></font>";
   echo "</tr>";
}

echo "</table>";
echo "</center>"; ?>
<?include("footer.php")?>

</body>
</html>
[/code]
This question is asked every second day by someone who doesn't know how to search the board. So common is this question that a solution has been posted in the sticky [url=http://www.phpfreaks.com/forums/index.php/board,41.0.html]code snippet / repository[/url] thread.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.