/    Sign up×
Community /Pin to ProfileBookmark

PHP Include Script Error

Howdy

Got this script of here a while ago but i get a parse error when i place it onto one of my pages.. anyone know why?

Cheers
Fet

to post a comment
PHP

11 Comments(s)

Copy linkTweet thisAlerts:
@LazyJonesJan 02.2006 — Pretty hard to tell without seeing the script. Or the error message.
Copy linkTweet thisAlerts:
@scottyrobauthorJan 02.2006 — That is a very good point! I thougt i included it.. lol here it is!

[code=php]<?php
if(!empty($_GET['page'])){
$page = $_GET['page'];
switch($page){
case "home";
$content = "home.php";
break;
case "products";
$content = "products.php";
break;
case "downloads";
$content = "downloads.php";
break;
case default;
$content = "home.php";
break;
}
}
include $content;
?>[/code]
Copy linkTweet thisAlerts:
@LazyJonesJan 02.2006 — Did you read the error message?

case default --> default
Copy linkTweet thisAlerts:
@scottyrobauthorJan 02.2006 — Did i read the error message? what do you mean? all i got was a parse error
Copy linkTweet thisAlerts:
@LazyJonesJan 02.2006 — This was what I got, and it was pretty clear

Parse error: parse error, unexpected T_DEFAULT in C:serveriphptestaapo.php on line 14

Maybe you should check your error configs in the php.ini
Copy linkTweet thisAlerts:
@acemoJan 02.2006 — remove the word case before default

like this:
[code=php]
<?php
if(!empty($_GET['page'])){
$page = $_GET['page'];
switch($page){
case "home";
$content = "home.php";
break;
case "products";
$content = "products.php";
break;
case "downloads";
$content = "downloads.php";
break;
default;
$content = "home.php";
break;
}
}
include $content;
?>
[/code]
Copy linkTweet thisAlerts:
@scottyrobauthorJan 02.2006 — Cheers that worked! just what i needed a straight simple answer!
Copy linkTweet thisAlerts:
@LazyJonesJan 02.2006 — which I gave you more then three hours ago ?
Copy linkTweet thisAlerts:
@acemoJan 02.2006 — Did you read the error message?

case default --> default[/QUOTE]


which I gave you more then three hours ago ?[/QUOTE]

sorry, but next time might wanna be more clear, cuz i didnt understood that one aswell.

Might wanna add something like this:

Change

case default --> default

wich still could be confusing for some ppl, so add in code tags where u put code

ur msg would look like this then:

Change
[code=php]case default[/code] --> [code=php]default[/code]
Copy linkTweet thisAlerts:
@scottyrobauthorJan 02.2006 — Thanks for that both of you! I didnt understand the message you wrote 3 hours ago, thats all ? Thanks though!
×

Success!

Help @scottyrob spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...