Troubleshooting & ldquo; Analysis error: syntax error, unexpected T_STRING & rdquo; in the echo statement

advertisements

I am back to php after like 5 years and I need help with the following please:) It keeps telling me the error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in header.php (in the first echo invoke)

<?php
$result = mysql_query("SELECT * FROM menu WHERE disabled=0 ORDER BY orderx ASC") or die(mysql_error());
$i=1;
while($row = mysql_fetch_array($result)) {

    echo "<li class='sddm'.$i.' '.$row[extra].'"><a href="'.link_text($row[link]).'" onmouseover=\"mopen('m2')\" onmouseout=\"mclosetime()\">'.link_text($row[link]).'</a>";
    echo "<div id='m2' onmouseover='mcancelclosetime()' onmouseout='mclosetime()'>";
    echo "<a href='#'>ASP Dropdown</a>";
    echo "<a href='#'>Pulldown menu</a>";
    echo "<a href='#'>AJAX dropdown</a>";
    echo "<a href='#'>DIV dropdown</a>";
    echo "</div>";
    echo "</li>";

    <!--echo '<li class="sddm'.$i.' '.$row[extra].'"><a href="'.link_text($row[link]).'">'.$row[title.langfix()].'</a>';-->
    echo'</li>';
    $i++;

}
?>


Your quotes are all out of whack:

echo "<li class='sddm'.$i.' '.$row[extra].'"><a href="'.link_text($row[link]).'"

Should be

echo '<li class="sddm"'.$i.' '.$row[extra].'"><a href="'.link_text($row[link]).'"

You can swap out the quotes accordingly if you wish to use single quotes in your HTML but this should show you where your error lies.