You are here: Help with a Parse Error « PHP « IT news, forums, messages
Help with a Parse Error

Posted by Tom Chubb on 07/31/05 16:38

I am trying to create my own news system and to start with I'm using
static news pages until I get the db working properly.
I'm using the following code:

<?php
if(!isset($_GET['id']))
{ $article="$id.php"
if (file_exists($article)) { include $article; }
else { echo "The article you've requested does not exist!"; }
}
else { echo "You did not select an article"; }
?>

I am testing using the following links...

www.myurl.co.uk/index.php
www.myurl.co.uk/index.php?id=1
www.myurl.co.uk/index.php?id=2

When I try the first one, I'd expect it to say you did not select an
article, but it says


Notice: Undefined variable: id in
/home/5217/tomchubb/public_html/index.php on line 15
The article you've requested does not exist


When I try the third link, I would expect it to say The article
you've requested does not exist! but it says:

Parse error: parse error in /home/5217/tomchubb/public_html/index.php on line 16

Lines 15 & 16 are:
if (file_exists($article)) { include $article; }
else { echo "The article you've requested does not exist!"; }

I don't understand why this isn't working and I've tried looking into
this for 2 hours!
Can anyone tell me where I'm going wrong please?

Thanks,

Tom
--
Tom Chubb
tom@ps-promo.co.uk

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация