Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,685 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,251 people online right now. Registration is fast and FREE... Join Now!




Parse Error - T_string?

 
Reply to this topicStart new topic

Parse Error - T_string?, Please Help!

muskaman
post 5 Oct, 2002 - 08:54 PM
Post #1


New D.I.C Head

*
Joined: 28 Jun, 2002
Posts: 44

CODE
<?php
//shoot da shit (function crap...go away)

function default() {
        include_once('c:\apache\htdocs\cb\cbv40\default.php');
        }
function affiliate() {
        include_once('c:\apache\htdocs\cb\include_onces\affiliate.php');
        }
function downloads() {
        include_once('c:\apache\htdocs\cb\include_onces\download.php');
        }
funtion games() {
        include_once('c:\apache\htdocs\cb\include_onces\games.php');
        }
function contact() {
        include_once('c:\apache\htdocs\cb\include_onces\contact.php');
        }
//end function crap....you can come back now
//ooh....cases and breaks and switches...can I press the button?
switch($p); {
case "affiliate":
     affiliate();
break;
case "downloads":
     downloads();
break;
case "games":
     games();
break;
case "contact":
     contact();
break;
default:
     default();
break;
}
?>

In that small sniplet of code, I get the following error:
QUOTE
Parse error: parse error, expecting `T_STRING' in c:\apache\htdocs\cb\nextgen\index.php on line 4


I can't find anything wrong, please help!
Yes, I am running the script locally
User is offlineProfile CardPM

Go to the top of the page

klewlis
post 5 Oct, 2002 - 09:26 PM
Post #2


cur tu me vexas?

*****
Joined: 9 Nov, 2001
Posts: 1,723

try taking the ; out of this line:

CODE

switch($p); {
User is offlineProfile CardPM

Go to the top of the page

muskaman
post 6 Oct, 2002 - 08:30 AM
Post #3


New D.I.C Head

*
Joined: 28 Jun, 2002
Posts: 44

Fixed, and still the parse error.
User is offlineProfile CardPM

Go to the top of the page

Spider
post 6 Oct, 2002 - 03:18 PM
Post #4


Arachnid

****
Joined: 10 Jul, 2002
Posts: 769


My Contributions


you said in this small bit of code, is that a page on it's own, or is it part of a larger page?

other than that, I would advise looking up the error message and finding out what it means. Sorry I can't be more helpful than that.
User is offlineProfile CardPM

Go to the top of the page

skrilla
post 7 Oct, 2002 - 06:08 AM
Post #5


boots.

*****
Joined: 5 Jul, 2002
Posts: 2,848



Dream Kudos: 14
My Contributions


we use a "switch" conditional system to power the core of morobo...and i think i found the problem:

default:
    default();
break;


ok on your last switch condition, in red, see how its just "default" etc? try taking that last "case" condition out and using this instead:

CODE

case "default":
default:
     default();
break;
}

let me know if that works or not smile.gif

-pete
User is offlineProfile CardPM

Go to the top of the page

gneato
post 10 Oct, 2002 - 09:36 PM
Post #6


<title>Untitled Document</title>

*****
Joined: 3 Sep, 2001
Posts: 1,311

don't use "default" for the function name.
User is offlineProfile CardPM

Go to the top of the page

gneato
post 10 Oct, 2002 - 09:39 PM
Post #7


<title>Untitled Document</title>

*****
Joined: 3 Sep, 2001
Posts: 1,311

The next error you will get is caused by a misspelling of "function" on line ~13.
User is offlineProfile CardPM

Go to the top of the page

gneato
post 10 Oct, 2002 - 09:42 PM
Post #8


<title>Untitled Document</title>

*****
Joined: 3 Sep, 2001
Posts: 1,311

If you didn't remove that semicolon, that will be the next error.

This works:

CODE
<?php
//shoot da shit (function crap...go away)

function dflt() {
       include_once('c:\apache\htdocs\cb\cbv40\default.php');
       }
function affiliate() {
       include_once('c:\apache\htdocs\cb\include_onces\affiliate.php');
       }
function downloads() {
       include_once('c:\apache\htdocs\cb\include_onces\download.php');
       }
function games() {
       include_once('c:\apache\htdocs\cb\include_onces\games.php');
       }
function contact() {
       include_once('c:\apache\htdocs\cb\include_onces\contact.php');
       }

//end function crap....you can come back now
//ooh....cases and breaks and switches...can I press the button?
switch($p) {
    case "affiliate":
         affiliate();
         break;
    case "downloads":
         downloads();
         break;
    case "games":
         games();
         break;
    case "contact":
         contact();
         break;
    default:
         dflt();
}
?>
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 07:05AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month