Jump to content


Can't Get Php Syntax Right

  • Please log in to reply
1 reply to this topic

#1 monkey64

  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 29 June 2006 - 09:21 PM

Hi there

I have some code which runs perfectly well in HTML, but falls over in PHP. I know I've got the wrong syntax. This is the code as from the HTML page.

<td class="menuoff" onmouseover="className='menuon';" onmouseout="className='menuoff';"></td>

I want to insert it in my PHP page, but I can't get the syntax right:

// Make a MySQL Connection


mysql_select_db("realbab_phpbb") or die(mysql_error());

// Get all the data from the table
$result = mysql_query("SELECT * FROM phpbb_posts_text")
or die(mysql_error());

echo "<table width='200' cellspacing='1' cellpadding='3'>";

// keeps getting the next row until there are no more to get

while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr>[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]<td class="menuoff" onmouseover="className='menuon';" onmouseout="className='menuoff';">[!--colorc--][/span][!--/colorc--]
echo $row['post_subject'];
echo "</td><td>";


echo "</table>";

Can anyone help?

#2 michaellunsford

  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 29 June 2006 - 09:28 PM

you just need to escape your double-quotes:
    // Print out the contents of each row into a table
    echo "<tr>[color=#FF0000]<td class=\"menuoff\" onmouseover=\"className='menuon';\" onmouseout=\"className='menuoff';\">";

also, you forgot to end your line with a closed double-quote and semi-colon.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users