Showing Code Inted Of What It's Ment To Be

Hi, Im New To PHP Coding And I Decided To Create A PHP Forum (ALago Logo Forums). I Did The "Register.html"File Then A “index.php” File. The Register.html File Worked Fine But When I Come To The Index I Get The Code On The Screen. Heres The Code:
[php]<?php
/*
/Copyright Alago Logo Forums (ALF)
/
/
/Licence http://alagologo.jimdo.com/licence/
/
/
/Offical Website http://alagologo.jimdo.com/
/
/
/
/Offical Forum http://alagoforumstestingwebsite.twomini.com/index.php
/
*/
// Now We Need To Put The Style Into Order

//Next We Need To Connect To A Database
$username = “u404949692_";
$password = "
***”;
$hostname = “mysql.**********.com”;

//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die(“Unable to connect to MySQL”);

// Next We Need To Create A Copyright For Our Forum Usage
echo “Powered By Alago Logo Forums (ALF)”;
// Thats All For Now
?>[/php]
Help PLZ

Line 17 is html code not php code.

So end the php at the end of line 16 and start it again at line 18 so

[php]
?>

<?php [/php]

Its Still The Same.

Oh… Iv Just Relised My database Password Is In Their

  1. You are already starting off on the wrong foot by learning/using obsolete Mysql code.
  2. A forum is pretty advanced for just starting out.

Ive Been Coding For Quite A While Now, BTW What Do You Mean By

?

The first sentence of your post says you are new to PHP coding. Mysql_* calls are obsolete. You need to use mysqli or PDO. My recommendation is PDO.

Back to the original topic:

Is the issue that all of the PHP shows, or that it shows an error, or what?

If this local and the database is located on a webserver or is all of it on the web server?

Is the web server running? PHP has to be interpreted, so if the interpreter is not running properly, the code will show as text. A way to test this is create a new page with a php extension. In that file have the following:

[php]<?php
phpinfo();
?>[/php]

If it shows that, it is not running. If it shows a list of what is installed, you are good.

It Shows The PHP Code On The File. Plus I Tryed Wamp But It Doesent Work.

I prefer XAMPP or Zend Server, but that is your issue. You need to disable IIS if it is running and start the apache server. Alternatively, you can run PHP with IIS, but it is a headache to configure and still runs into problems.

Sponsor our Newsletter | Privacy Policy | Terms of Service