Jump to content
php.lv forumi

Problema ar tabulas krasojumu


lizard

Recommended Posts

Rekur scripts, diezgan vienakrsh, kas no datunbazes izvada datus stabinja uz leju. Vajag uztaisit ta lai shunu krasojums butu viens pec viena(tumshi dzeltens, gailshi dzletens) to ari es itka izdariju, bet vinsh visas shunas tabula kraso viena krasa, kapec ta. Kur varetu but kljuda?

 

$query = "SELECT * FROM products WHERE categoryID='$select'";
$result = mysql_query($query);
$i = 0;
Print("<table width='524' cellpadding='3' cellspacing='0' border='0' class='cat_table'>");
while(($row = mysql_fetch_row($result)) !== false) {
$i++;
$i = 0;
if ($i % 1)
{
$bgcolor = "bgcolor='#F7FFD9'";
}
else
{
$bgcolor = "bgcolor='#FDFFF7'";	
}

Print("<tr $bgcolor onmouseover='this.style.backgroundColor='#D4EBFF';' onmouseout='this.style.backgroundColor='#F7FFD9';'>");
Print("<td class='cat_item' width='16' height='16'><img src='img/zoom.gif' border='0'></td>");
Print("<td class='cat_item' width='440'><a href='index.php?zoom=".$row[0]."$link' class='cat_link'>".$row[1]."</td>");
Print("<td class='cat_item' width='60'>".$row[3]." Ls</td>");
Print("<td class='cat_item' width='34' align='middle'><a href='#' class='cat_link'>Groza</a></td>");
Print("</tr>");	

}

print "</table>";

Link to comment
Share on other sites

Paprasi pats sev:

Ko nozīmē $i

Ko nozīmē $i++

Ko nozīmē $i=0

 

Ja kaut uz vienu uz šiem jautājumiem nespēj atbildēt, tad ver vaļā php manuāli un lasi, nevis gaidi, kad citi labos tavus skriptus.

 

Un tu vēl php skriptu ātrumus optimizēt sataisījies... phe.

Link to comment
Share on other sites

×
×
  • Create New...