monkey64 Posted June 29, 2006 Share Posted June 29, 2006 Hi thereI 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 getwhile($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 https://forums.phpfreaks.com/topic/13254-cant-get-php-syntax-right/ Share on other sites More sharing options...
michaellunsford Posted June 29, 2006 Share Posted June 29, 2006 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 https://forums.phpfreaks.com/topic/13254-cant-get-php-syntax-right/#findComment-51027 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.