Jump to content

php table help


Porkie

Recommended Posts

 

 

print ("<table>");
    print ("<tr>");
    print ("<td>");
echo 'smooth'
print ("</td>");
print ("</tr>");
print ("<tr>");
    print ("<td>");
    echo 'lala'
    print ("</td>");
    print ("<td align="left" valign="top">");
    echo '<h2>Description</h2>';
echo stripslashes($video['description']);
    print ("</td>");
    print ("</tr>");
    print ("</table>");

 

my problem is i want description to be shown at the top of the box so i tried using valign however dont understand why i get an error?

 

Parse error: syntax error, unexpected T_STRING in /home/public_html/Newdirectory/video.php on line 70 , line 70 being the valign line

 

cheers in advance

Link to comment
https://forums.phpfreaks.com/topic/163982-php-table-help/
Share on other sites

You need to escape any double quotes within your string, like so

print ("<td align=\"left\" valign=\"top\">");

 

If you don't escape your quotes PHP will end your string prematurely and thus you'll get the error you're retrieving.

 

Or start your string with single quotes

print ('<td align="left" valign="top">');

 

Also there's no need to echo each line separately. echo/print can span multiple lines, like so

echo '<table>
  <tr>
    <td>smooth</td>
  </tr>
  <tr>
    <td>lala</td>
    <td align="left" valign="top">
      <h2>Description</h2>'.
      stripslashes($video['description']).'
    </td>
  </tr>
</table>';

 

Link to comment
https://forums.phpfreaks.com/topic/163982-php-table-help/#findComment-865075
Share on other sites

Archived

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

×
×
  • 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.