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