Jump to content

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

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.