Hello and welcome to our community! Is this your first visit?
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
    Nov 2012
    Thanked 1 Time in 1 Post

    Please solve my parse errors

    following is my php code and the error reads like this parse error in .../mainthead php at line 4 - unexpected T_STRING, expecting ',' or ';'

    echo "<!--- Main Head Starts --->;
    \n<link href="assets/jodohStyles.css" rel="stylesheet" type="text/css" /> \n " ;
    \n<link rel="stylesheet" href="assets/style.css"/>
    echo "<s";
    echo "tyle type="text/css">
    \n -->
    <div id="page">
    <span id="e1"></span>
    \n <d";
    \n " ;

  2. AdSlot6
  3. #2
    Regular Coder
    Join Date
    Nov 2012
    Thanked 12 Times in 12 Posts
    You're using the same double qoutes to set the link attributes as you are to open and close the echo string.

    PHP Code:
     echo "<!--- Main Head Starts --->;
     \n<link href="
    assets/jodohStyles.css" rel="stylesheet" type="text/css" /> \n " ;
    // should be
    echo "<!--- Main Head Starts --->";
    n<link href='assets/jodohStyles.css' rel='stylesheet' type='text/css' /> \";
    // or escape the double quotes using \" 
    Also, you close line 4 using " ; , but continue on line 5 with \n. That can't happen. I think the full lines you are looking for are:

    PHP Code:
    echo "<!--- Main Head Starts --->";
    "\n<link href=\"assets/jodohStyles.css\" rel=\"stylesheet\" type=\"text/css\" /> \n " ;
    "\n<link rel=\"stylesheet\" href=\"assets/style.css\"/> \n"
    In other words, if you end a line with a ; , you need to start the next line with an echo. Otherwise don't close the preceding line with ;, but use a dot instead.

    Hope that explains


  4. Users who have thanked Thyrosis for this post:

    ramsingh (11-27-2012)

  5. #3
    Senior Coder durangod's Avatar
    Join Date
    Nov 2010
    southwestern USA
    Thanked 34 Times in 33 Posts
    sorry but i hate when people do long strings of echo, its not only a pain to work with but its miserable to try to do normal code having to worry about quotes.

    why dont you just turn off php

    do your html

    then turn php back on

    and repeat the process. lol

    the problem is if you do echo nothing inside that echo can have double quotes unless its a special formated var using dots so you made my point exactly why i hate long strings of echo. You had double quotes inside of double quotes, you cant do that. if your echo has double quotes to start, you can use single quotes inside of that but the next double quote better be the close of that echo, as i said unless its a special formated php var statement.

    i left your session and row stuff alone, but you cant look at session that way you have to use print_r to do that, you can use the format you have only if you are looking at a particular key of session like

    to see all of session you can do

    PHP Code:
    and to see a certain part of session you do this

    PHP Code:
    you need to fix that down there before running this

    This is much cleaner
    PHP Code:


    <!--- Main Head Starts --->

    <link href="assets/jodohStyles.css" rel="stylesheet" type="text/css" /> 
    <link rel="stylesheet" href="assets/style.css"/>

    <style type="text/css">

    /* put style stuff here */


    <div id="page">
    <span id="e1"></span>

    <br />
    <br />
    <br />
    Last edited by durangod; 11-27-2012 at 11:06 AM.

  6. Users who have thanked durangod for this post:

    ramsingh (11-27-2012)


Tags for this Thread

Posting Permissions

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