PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
nickman013
Forum Regular
Posts: 764 Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York
Post
by nickman013 » Thu Aug 24, 2006 11:34 pm
Hello,
I am outputting rows from a DB, but I am having trouble becasue I need the rows to change color when they are highlighted, but I am having a major apostrophe problem.
My code now.
Code: Select all
echo "<tr style="background-color:#CCCCCC;"
onMouseOver="this.className='highlight'">";
echo "<td align=left width=100 valign=top><font size=2>".$row4['name']."</font></td>";
echo "<td align=left><font size=2>".$row4['comment']."</font></td>";
echo '<td><font size=2><a href=/deletecomment.php?id='.$row4['id'].'>Delete Comment</a></td></tr>';
Can anybody make the first echo work for me, ive been tryign for like a hour.
Thanks so much!!!
Luke
The Ninja Space Mod
Posts: 6424 Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA
Post
by Luke » Thu Aug 24, 2006 11:41 pm
nickman013 wrote: Code: Select all
echo "<tr style="background-color:#CCCCCC;" onMouseOver="this.className='highlight'">";
echo "<td align=left width=100 valign=top><font size=2>".$row4['name']."</font></td>";
echo "<td align=left><font size=2>".$row4['comment']."</font></td>";
echo '<td><font size=2><a href=/deletecomment.php?id='.$row4['id'].'>Delete Comment</a></td></tr>';
Try that
nickman013
Forum Regular
Posts: 764 Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York
Post
by nickman013 » Thu Aug 24, 2006 11:49 pm
Thanks that worked!!
But now I have a client side question, but I dont wanna open a new thread for this question.
The question is, do you know why the background color doesnt change when the mouse is on it.
The code is this.
Code: Select all
echo "<tr style=\"background-color:#CCCCCC;\" onMouseOver=\"background-color:#8888FF;\">";
Luke
The Ninja Space Mod
Posts: 6424 Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA
Post
by Luke » Thu Aug 24, 2006 11:55 pm
or you could do something like this (stolen from phpmyadmin)
Code: Select all
table tr.odd:hover{
background-color: #CCFFCC;
}
nickman013
Forum Regular
Posts: 764 Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York
Post
by nickman013 » Fri Aug 25, 2006 12:05 am
I did the one above, but it doesnt seem to work.
My code now.
Code: Select all
<style type=text/css>
table tr.odd:hover{
background-color:#CCFFCC;
}
</style>
<table border=0>
<tr><td><b>NAME</b></td><td><b>COMMENT</b></td></tr>
<?
$username2= "muot_report";
$password2= "password";
$database2= "muot_report";
$connection2 = mysql_connect('localhost',$username2,$password2);
mysql_select_db($database2);
$sql4 = "SELECT * FROM `comments` WHERE who =" . $_GET['id'] . "";
$result4 = mysql_query($sql4) or die(mysql_error());
while($row4 = mysql_fetch_array($result4)) {
echo "<tr>";
echo "<td align=left width=100 valign=top><font size=2>".$row4['name']."</font></td>";
echo "<td align=left><font size=2>".$row4['comment']."</font></td>";
echo '<td><font size=2><a href=/deletecomment.php?cmtid='.$row4['id'].'&muotid='.$_GET['id'].'>Delete Comment</a></td></tr>';
} mysql_close($connection2);
?>
</table>
THANKS SO MUCH!
nickman013
Forum Regular
Posts: 764 Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York
Post
by nickman013 » Fri Aug 25, 2006 12:07 am
I got it. I re-read the CSS and didnt relize I had to label the rows.
Thanks so Much!!
Luke
The Ninja Space Mod
Posts: 6424 Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA
Post
by Luke » Fri Aug 25, 2006 12:11 am