7 Replies - 2019 Views - Last Post: 10 October 2002 - 10:42 PM Rate Topic: -----

#1 muskaman   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 44
  • Joined: 28-June 02

Parse Error - T_string?

Posted 05 October 2002 - 09:54 PM

<?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

Is This A Good Question/Topic? 0
  • +

Replies To: Parse Error - T_string?

#2 klewlis   User is offline

  • cur tu me vexas?

Reputation: 8
  • View blog
  • Posts: 1,723
  • Joined: 09-November 01

Re: Parse Error - T_string?

Posted 05 October 2002 - 10:26 PM

try taking the ; out of this line:

switch($p); {


Was This Post Helpful? 0
  • +
  • -

#3 muskaman   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 44
  • Joined: 28-June 02

Re: Parse Error - T_string?

Posted 06 October 2002 - 09:30 AM

Fixed, and still the parse error.
Was This Post Helpful? 0
  • +
  • -

#4 Spider   User is offline

  • Arachnid

Reputation: 2
  • View blog
  • Posts: 769
  • Joined: 10-July 02

Re: Parse Error - T_string?

Posted 06 October 2002 - 04:18 PM

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.
Was This Post Helpful? 0
  • +
  • -

#5 skrilla   User is offline

  • boots.

Reputation: 2
  • View blog
  • Posts: 3,096
  • Joined: 05-July 02

Re: Parse Error - T_string?

Posted 07 October 2002 - 07:08 AM

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:

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


let me know if that works or not :)

-pete
Was This Post Helpful? 0
  • +
  • -

#6 gneato   User is offline

  • <title>Untitled Document</title>

Reputation: 0
  • View blog
  • Posts: 1,311
  • Joined: 03-September 01

Re: Parse Error - T_string?

Posted 10 October 2002 - 10:36 PM

don't use "default" for the function name.
Was This Post Helpful? 0
  • +
  • -

#7 gneato   User is offline

  • <title>Untitled Document</title>

Reputation: 0
  • View blog
  • Posts: 1,311
  • Joined: 03-September 01

Re: Parse Error - T_string?

Posted 10 October 2002 - 10:39 PM

The next error you will get is caused by a misspelling of "function" on line ~13.
Was This Post Helpful? 0
  • +
  • -

#8 gneato   User is offline

  • <title>Untitled Document</title>

Reputation: 0
  • View blog
  • Posts: 1,311
  • Joined: 03-September 01

Re: Parse Error - T_string?

Posted 10 October 2002 - 10:42 PM

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

This works:

<?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();
}
?>

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1