[HELP] Is there something wrong with this PHP code? -
Tarantula - 13.12.2011
Right. So I'm pretty much a noob when it comes to PHP. I've only just decided to be assed to learn it, and so I started with the basic "copying and typing it out and trial and error". Obviously, I had errors, I looked back at the TKAdmin PHP code to see how the creator defined 'FORUMURL' and though "Well. PHP isn't as hard as I thought" and decided to copy it.
Now, it's a little... Noobish, and some of you would probably laugh at the way I did it.. But, heres the code.
Код:
<?php
if(!defined ('FORUMURL'))
{
define('FORUMURL', 'http://www.siliconrp.net63.net');
}
echo "<h1>Hello World!</h1>";
if(defined("FORUMURL")) echo "<li><a href='FORUMURL'>Forums</a></li>"; else echo "<p> </p>";
?>
Now, (I'm using WeBuilder), and in 'preview' mode it outputs "Not Found".
Any help appreciated, and +rep given.
Re: [HELP] Is there something wrong with this PHP code? -
JiHost - 13.12.2011
Is it displaying HTTP 404 error?
I'm not familiar with WeBuilder but try accessing it over your browser over address "http://localhost/scriptname.php".
Script itself seems fine although there are easier ways to do it.
Re: [HELP] Is there something wrong with this PHP code? -
Tarantula - 13.12.2011
Quote:
Originally Posted by JiHost
Is it displaying HTTP 404 error?
I'm not familiar with WeBuilder but try accessing it over your browser over address "http://localhost/scriptname.php".
Script itself seems fine although there are easier ways to do it.
|
Its runs off PHP.exe so Apache is not needed via XAMPP
Re: [HELP] Is there something wrong with this PHP code? -
Pinguinn - 13.12.2011
It should be this:
PHP код:
<?php
if(!defined ('FORUMURL'))
{
define('FORUMURL', 'http://www.siliconrp.net63.net');
}
echo "<h1>Hello World!</h1>";
if(defined("FORUMURL")) echo "<li><a href=".FORUMURL.">Forums</a></li>"; else echo "<p> </p>";
?>
You cannot display defines inside quotes.
Re: [HELP] Is there something wrong with this PHP code? -
Tarantula - 13.12.2011
Quote:
Originally Posted by Pinguinn
It should be this:
PHP код:
<?php
if(!defined ('FORUMURL'))
{
define('FORUMURL', 'http://www.siliconrp.net63.net');
}
echo "<h1>Hello World!</h1>";
if(defined("FORUMURL")) echo "<li><a href=".FORUMURL.">Forums</a></li>"; else echo "<p> </p>";
?>
You cannot display defines inside quotes.
|
Ah. Thanks.