Jump to content

Can't Get Php Syntax Right


monkey64

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?
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.