Hi,
I'm builing a website for an cultural association, and I add a page where it's shown the list of the shorfilms the association produced (sorting them through the database). Now, the result is shown on a table, what I want is to make each other row to have a different backgorund color in order for the user to read the page better. I thought I could do something like that with counters... but it didn't seem to work. That's the code I've wrote:
<?php
include ("miscinc/conn.inc");
$cxn = mysqli_connect($host,$user,$password,$database)
or die ("Impossibile connettersi al server.");
$query = "SELECT * FROM corti";
$result = mysqli_query($cxn,$query)
or die ("Impossibile eseguire la richiesta.");
echo "<table align='center' width='80%' cellspacing='5' border='0' cellpadding='0'>";
while($row = mysqli_fetch_assoc($result))
{
extract($row);
for($i=1;$i<2;$i++)
{
if($i*=1)
{
echo "<tr>
<td><h3>$i {$row['edizione']}</h3></td>\n";
echo "<td><a href='filmato.php?titolo={$row['titolo']}'><b>{$row['titolo']}</b></td>\n";
echo "<td><h3>di {$row['regista']}</h3></td>\n";
echo "<td><h3>{$row['descrizione']}</h3></td>\n";
echo "<td align='center'><img src='img/{$row['pix']}'></td></tr>\n";
}
if($i*=2)
{
echo "<tr [COLOR="Red"]style='background-color:red'[/COLOR]>
<td><h3>$i {$row['edizione']}</h3></td>\n";
echo "<td><a href='filmato.php?titolo={$row['titolo']}'><b>{$row['titolo']}</b></td>\n";
echo "<td><h3>di {$row['regista']}</h3></td>\n";
echo "<td><h3>{$row['descrizione']}</h3></td>\n";
echo "<td align='center'><img src='img/{$row['pix']}'></td></tr>\n";
}
}
}
echo "</table><hr />";
?>
Can somebody help me? Thanks a lot in advance!
Ricroma
PS. Another question: is there somewhere a script for a really simple search engine I could insert in my web site? What I would like is a search engine that could sort not only through all the database, but also through single categories, like is somebody want to search only the movies made by one director...