Professional Web Applications Themes

Unexpected T_STRING error in tutorial - Dreamweaver AppDev

I am working along in the Trio Motors tutorial, have just inserted the dynamic content from the 'COMMENTS' table in the database. The tutorial suggests that I preview the dynamic results by using the 'Live Data View' function, but when I do I get a p error that indicates an "unexpected T_STRING on line 24." I clicked the 'more info' button on the error popup and tried surfing the support site but can't seem to find help on this specific error. What is "unexpected T_STRING"? Does that mean text string? here is the code on lines 22-26: +++++++++++ line 22 ...

  1. #1

    Default Unexpected T_STRING error in tutorial

    I am working along in the Trio Motors tutorial, have just inserted the dynamic
    content from the 'COMMENTS' table in the database. The tutorial suggests that
    I preview the dynamic results by using the 'Live Data View' function, but when
    I do I get a p error that indicates an "unexpected T_STRING on line 24." I
    clicked the 'more info' button on the error popup and tried surfing the support
    site but can't seem to find help on this specific error.

    What is "unexpected T_STRING"? Does that mean text string? here is the code
    on lines 22-26:

    +++++++++++
    line 22 $totalPages_rs_Comments =
    ceil($totalRows_rs_Comments/$maxRows_rs_Comments)-1;
    line 23 ?>
    line 24 <?xml version="1.0" encoding="iso-8859-1"?>
    line 25 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    line 26 <html xmlns="http://www.w3.org/1999/xhtml">
    +++++++++++

    I am guessing there is a typo in here somewhere, but I cannot see it. Can
    anyone help?

    Thanks!

    New_Editor Guest

  2. #2

    Default Re: Unexpected T_STRING error in tutorial

    The problem is that you have:

    <?xml version="1.0" encoding="iso-8859-1"?>

    The PHP pr thinks <? is a PHP tag, not part of the XML definition, as
    you have short PHP tags enabled on your server. Rewrite it as

    echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>";

    Will do the same job, but won`t conflict with PHP


    --
    Gareth - TMM Dreamweaver
    http://www.dreamweavermxsupport.com/

    PHP Login Suite V2 - 34 Server Behaviors to build a complete Login system.
    http://www.phploginsuite.co.uk/


    gareth Guest

  3. #3

    Default Re: Unexpected T_STRING error in tutorial

    Thanks Gareth -

    Actually, that fix did not work...I still got the same error, both when I
    changed the existing line and when I cut and pasted your line in its place.
    The explanation makes sense, especially since the short-tag problem seems to
    have been experienced by others in earlier threads. The problem in my case is
    I am unable to adjust the settings on the test server I am using.

    What fixed the problem for me was deleting line 24 completely. Hope that
    doesn't cause problems later in the tutorial!

    New_Editor Guest

  4. #4

    Default Re: Unexpected T_STRING error in tutorial

    You may have to use:

    echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?" . ">";


    --
    Gareth - TMM Dreamweaver
    http://www.dreamweavermxsupport.com/

    PHP Login Suite V2 - 34 Server Behaviors to build a complete Login system.
    http://www.phploginsuite.co.uk/


    gareth Guest

  5. #5

    Default Re: Unexpected T_STRING error in tutorial

    Hi,

    I'd the same problem, and effectively the short tags were enabled for PHP.
    The best method is to disable short tags modifying the php.ini file :
    short_open_tage =Off
    (see http://codewalkers.com/phpdocs/configuration.directives.html)

    With short tags disabled, PHP and XML can coexist, and the code created can
    execute on all machines).

    Bye


    atchoum9 Guest

  6. #6

    Default Re: Unexpected T_STRING error in tutorial

    .oO(atchoum9)
     

    While you can do this on your own machine, it's not always possible to
    do it on your host's server. So another way to avoid this problem is to
    use PHP's print or echo statement to print out the XML prolog.

    Micha
    Michael Guest

Similar Threads

  1. unexpected T_STRING in (newbe)
    By Québec in forum PHP Development
    Replies: 12
    Last Post: August 28th, 08:57 PM
  2. P error: p error, unexpected T_STRING
    By Chris in forum PHP Development
    Replies: 4
    Last Post: April 5th, 12:53 AM
  3. PHP P error: p error, unexpected t_string
    By subsidence in forum Dreamweaver AppDev
    Replies: 0
    Last Post: April 2nd, 09:58 PM
  4. unexpected T_STRING problem..
    By Marc Collin in forum PHP Development
    Replies: 1
    Last Post: April 29th, 02:03 PM
  5. p error, unexpected T_STRING
    By Kurt Milligan in forum PHP Development
    Replies: 0
    Last Post: July 11th, 01:38 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139