Hi there
I guess I am what you would call a newbie to php and mySQL... Ive just
created my first guestbook "tagwall" in php using a mysql database to store
the messages. So far so good, it works fine and im pleased. Now its time for
som cosmetic changes and this is where i need your help. I have no idea how
im supposed to do this, I want every other post to have a different
background color.
For example:
Post nr.1 has bg-color: #000000
Post nr.2 has bg-color: #FFFFFF
Post nr.3 has bg-color: #000000
Post nr.4 has bg-color: #FFFFFF
and so on......
Can this be done with a php-script or am I to do this when im fetching my
data from the database?
Any suggestions / pseudo-code / hints / complete solutions :-D are welcome
and greatly appriciated.
If you would be so kind as to reply to phenixthebird@h otmail.com I would be
greatful.
( this is how i retrive my data, should this be changed?)
<?
$result = mysql_query("se lect * from tagwall order by id desc");
//Gets all data from table "tagwall" and sorts by ID, desc. ..desc can be
replaced with asc.
while($row = mysql_fetch_arr ay($result)) {
echo"<tr><td class='spacing' ><font face=verdana size=1><b>$row[navn]</b> :
$row[msg]</td></tr>\n";
}
?>
I guess I am what you would call a newbie to php and mySQL... Ive just
created my first guestbook "tagwall" in php using a mysql database to store
the messages. So far so good, it works fine and im pleased. Now its time for
som cosmetic changes and this is where i need your help. I have no idea how
im supposed to do this, I want every other post to have a different
background color.
For example:
Post nr.1 has bg-color: #000000
Post nr.2 has bg-color: #FFFFFF
Post nr.3 has bg-color: #000000
Post nr.4 has bg-color: #FFFFFF
and so on......
Can this be done with a php-script or am I to do this when im fetching my
data from the database?
Any suggestions / pseudo-code / hints / complete solutions :-D are welcome
and greatly appriciated.
If you would be so kind as to reply to phenixthebird@h otmail.com I would be
greatful.
( this is how i retrive my data, should this be changed?)
<?
$result = mysql_query("se lect * from tagwall order by id desc");
//Gets all data from table "tagwall" and sorts by ID, desc. ..desc can be
replaced with asc.
while($row = mysql_fetch_arr ay($result)) {
echo"<tr><td class='spacing' ><font face=verdana size=1><b>$row[navn]</b> :
$row[msg]</td></tr>\n";
}
?>
Comment