This is an included file on one of my PHP sites on localhost:
<?
//connect to mysql
//change user and password to your mySQL name and password
mysql_connect("localhost","root","PASSWORDDELETED");
//select which database you want to edit
mysql_select_db("myradiostation1");
//select the table
$result = mysql_query("select * from presenters");
//grab all the content
while($r=mysql_fetch_array($result))
{
//the format is $variable = $r["nameofmysqlcolumn"];
//modify these to match your mysql table columns
$showtime=$r["showtime"];
$dj=$r["dj"];
$showinfo=$r["showinfo"];
$presenterimage=$r["presenterimage"];
echo " <ol class=\"schedList\">
<li class=\"\">
<h4><span>$showtime</span> $dj</h4>
<p>$showdesc</p>
<a href=\"http://www.example.com\" class=\"more\">More about example</a>
<img src=\"$presenterpic\" alt=\"Non - Stop Music\" />
</li>";
}
?>
What I'm trying to do is use a switch statement in this code, so that one column is like this:
<li class=\"\">
<h4><span>$showtime</span> $dj</h4>
<p>$showdesc</p>
<a href=\"http://www.example.com\" class=\"more\">More about example</a>
<img src=\"$presenterpic\" alt=\"Non - Stop Music\" />
</li>";
and
<li class=\"test1\">
<h4><span>$showtime</span> $dj</h4>
<p>$showdesc</p>
<a href=\"http://www.example.com\" class=\"more\">More about example</a>
<img src=\"$presenterpic\" alt=\"Non - Stop Music\" />
</li>";
I've already got the li class declared in my CSS, I just need to try and switch it to the test1 class every other record, like this:
1 - no class
2 - test1 css
3 - no class
4 - test1 css
If anyone knows how to do this I'd appreciate the help!
Thanks