What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » PHP Question

PHP Question
Author: Message:
davidpolitis
Full Member
***


Posts: 371
Reputation: 16
Joined: Aug 2006
RE: RE: PHP Question
quote:
Originally posted by Eddie
code:
<div id="content">
    <?
      $page = GET['p'];
      $llama = "./page/"."$page".".mdu";
      if(file_exists($llama) == TRUE){
          include ($llama);
      }
      else{
          include("error.php")
      }
?>
    </div>

Is returning the following error;

Parse error: parse error in C:\xampp\htdocs\vabase\main.php on line 29

Line 29 is "$page = GET['p'];"
php code:
<div id="content">
<?php
$page = $_GET['p'];
$llama = "./page/".$page.".mdu";
if(file_exists($llama)) {
  include($llama);
}
else {
  include("error.php");
}
?>
</div>

I"ll explain what was wrong with your code.
1. I changed the PHP opening to "<?php" because short tags (<?) need to be enabled on whatever server you decide to upload to.
2. Line 3 was using "GET", instead of "$_GET".
3. Where you set $llama, you had $page in quotes, unnecessarily.
4. Line 5 is using an if with file_exists. Since file_exists returns a boolean, "if(file_exists($llama))" works and is also shorter.
5. The include in your else contained no ";" (thanks for the heads up nana. Didn't notice it. XD)

Eddie, you should try find some books at the library like I did when I first started or find some e-books. You need to learn the language at least a bit before trying to make yourself some sought of system using database entries etc.

P.S. Sorry for editing my post so many times. XD

This post was edited on 04-03-2009 at 07:10 AM by davidpolitis.
04-03-2009 06:55 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
PHP Question - by Eddie on 03-31-2009 at 02:29 PM
RE: PHP Question - by matty on 03-31-2009 at 03:42 PM
RE: PHP Question - by stoshrocket on 03-31-2009 at 03:48 PM
RE: PHP Question - by Eddie on 03-31-2009 at 04:28 PM
RE: PHP Question - by MeEtc on 03-31-2009 at 04:43 PM
RE: PHP Question - by Eddie on 03-31-2009 at 04:49 PM
RE: PHP Question - by stoshrocket on 03-31-2009 at 05:07 PM
RE: PHP Question - by Eddie on 03-31-2009 at 05:16 PM
RE: PHP Question - by stoshrocket on 03-31-2009 at 05:30 PM
RE: PHP Question - by Eddie on 03-31-2009 at 05:47 PM
RE: PHP Question - by stoshrocket on 03-31-2009 at 05:49 PM
RE: PHP Question - by davidpolitis on 04-02-2009 at 07:43 AM
RE: PHP Question - by Eddie on 04-02-2009 at 08:33 AM
RE: RE: PHP Question - by davidpolitis on 04-02-2009 at 12:52 PM
RE: PHP Question - by stoshrocket on 04-02-2009 at 12:10 PM
RE: PHP Question - by segosa on 04-02-2009 at 10:05 PM
RE: RE: PHP Question - by davidpolitis on 04-03-2009 at 06:49 AM
RE: RE: RE: PHP Question - by segosa on 04-03-2009 at 08:09 AM
RE: PHP Question - by stoshrocket on 04-02-2009 at 11:23 PM
RE: PHP Question - by Eddie on 04-03-2009 at 06:50 AM
RE: RE: PHP Question - by davidpolitis on 04-03-2009 at 06:55 AM
RE: PHP Question - by NanaFreak on 04-03-2009 at 06:54 AM
RE: PHP Question - by NanaFreak on 04-03-2009 at 07:06 AM
RE: RE: PHP Question - by davidpolitis on 04-03-2009 at 07:16 AM
RE: PHP Question - by Felu on 04-03-2009 at 09:37 AM
RE: RE: PHP Question - by davidpolitis on 04-03-2009 at 10:15 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On