Jump to content

Archived

This topic is now archived and is closed to further replies.

monkey64

Can't Get Php Syntax Right

Recommended Posts

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:

<?php
// Make a MySQL Connection

$host="localhost";
$user="realbab_mark";
$password="xxxx";

mysql_connect($host,$user,$password);
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?

Share this post


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

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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.