Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    May 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help correcting php formatting

    I am trying to output data from the db through php.

    PHP Code:
    echo "<div style="overflowautowidth585pxheight370pxframeborder:0"><table>"
    but when i try to use a div, i receive the following error:

    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'

  • #2
    Regular Coder
    Join Date
    Mar 2006
    Posts
    121
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You have to either escape the doubt quotes in the string:

    PHP Code:
    echo "<div style=\"overflow: auto; width: 585px; height: 370px; frameborder:0\"><table>"
    or use single quotes instead of double quotes around the string:

    PHP Code:
    echo '<div style="overflow: auto; width: 585px; height: 370px; frameborder:0"><table>'
    The problem is that when the parser reaches the "overflow.. part it thinks its the end of the string you are echoing, and so expects a semi-colon or comma.

  • #3
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Or break out in to HTML if you have a lot of HTML coding.

    If you are not doing so already then use an editor with snytax highlighting. It will help with strings and quotes.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •