Jump to content

Could someone tell me why my code dont work?


MasterRenny

Recommended Posts

Hello

 

Ive been trying to debug my code, but i cant seem to see whats up with it!

 

Heres My links

 

    <li><a HREF="?link=Home">Home</a> </li>
    <li><a HREF="?link=About">About</a></li>
    <li><a HREF="?link=Rules"> Rules</a></li>
    <li><a HREF="?link=News">News</a></li>
    <li><a HREF="?link=Downloads">Downloads</a></li>

 

And heres my code for where i want it to show;

 

<?PHP
if($_GET['link'] == "Home"){ include("/news/show_news.php"); }
elseif($_GET['link'] == "About"){ include("/about.html"); }
elseif($_GET['link'] == "Rules"){ include("/rules.html"); }
elseif($_GET['link'] == "News"){ include("/news/show_archives.php"); }
elseif($_GET['link'] == "Downloads"){ include("/downloads.html"); }
else{ include("/news/show_news.php"); }
?>

 

any ideas? im really confuzed on why its not working becuase it use to work!

 

Thanks,

Renny

Oh yer sorry forgot  ::)

 

 

when i load it all all i get is a black page, and when i click on a link the page dont show

 

http://www.spartansguild.co.uk/ <<<<< see =[

 

 

the massive blank area to the left is where the text is ment to show up

 

And ok ill try adding the code =]

Your including your files wrong, remove "/filename.html" after the filenames.

 

 

sorry dont understand oO

 

try this

 

<?php

if($_GET['link'] == "Home"){ include("news/show_news.php"); }
elseif($_GET['link'] == "About"){ include("about.html"); }
elseif($_GET['link'] == "Rules"){ include("rules.html"); }
elseif($_GET['link'] == "News"){ include("newsshow_archives.php"); }
elseif($_GET['link'] == "Downloads"){ include("downloads.html"); }
else{ include("news/show_news.php"); }
?>

Your including your files wrong, remove "/filename.html" after the filenames.

 

 

sorry dont understand oO

 

try this

 

<?php

if($_GET['link'] == "Home"){ include("news/show_news.php"); }
elseif($_GET['link'] == "About"){ include("about.html"); }
elseif($_GET['link'] == "Rules"){ include("rules.html"); }
elseif($_GET['link'] == "News"){ include("newsshow_archives.php"); }
elseif($_GET['link'] == "Downloads"){ include("downloads.html"); }
else{ include("news/show_news.php"); }
?>

 

 

 

Nope still dont work

Can you post the entire script please? Or is this it?

 

Also, you might want to try

 

<?php
error_reporting(E_ALL);

ini_set('display_errors', true);


?>

 

Oh, he listens to you then. *sulks* :P

 

=]

 

 

But yes it didnt work, and since i put that code in my page it works fine now!

 

thanks again

Can you post the entire script please? Or is this it?

 

Also, you might want to try

 

<?php
error_reporting(E_ALL);

ini_set('display_errors', true);


?>

 

Oh, he listens to you then. *sulks* :P

 

=]

 

 

But yes it didnt work, and since i put that code in my page it works fine now!

 

thanks again

 

I beg to differ. :P It works now in principle but in reality:

 

Warning: main(about.html) [function.main]: failed to open stream: No such file or directory in /home/eternalg/public_html/index.php on line 53

 

Warning: main(about.html) [function.main]: failed to open stream: No such file or directory in /home/eternalg/public_html/index.php on line 53

 

Warning: main() [function.include]: Failed opening 'about.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/eternalg/public_html/index.php on line 53

 

-and-

 

Warning: main(newsshow_archives.php) [function.main]: failed to open stream: No such file or directory in /home/eternalg/public_html/index.php on line 55

 

Warning: main(newsshow_archives.php) [function.main]: failed to open stream: No such file or directory in /home/eternalg/public_html/index.php on line 55

 

Warning: main() [function.include]: Failed opening 'newsshow_archives.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/eternalg/public_html/index.php on line 55

 

-and-

 

Warning: main(downloads.html) [function.main]: failed to open stream: No such file or directory in /home/eternalg/public_html/index.php on line 56

 

Warning: main(downloads.html) [function.main]: failed to open stream: No such file or directory in /home/eternalg/public_html/index.php on line 56

 

Warning: main() [function.include]: Failed opening 'downloads.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/eternalg/public_html/index.php on line 56

 

Sam

Yer thats becuase ive not uploaded them 3 files yet =]

 

 

ill upload them, give me a sec and then you'll see it all works nicely ^.^

 

That could indeed explain it. ;)

 

Glad you got it working.

 

Sam

 

Despite the fact he didn't upload the files, he didn't include them the right way either.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.