Tuesday, June 12, 2012

New Website that I have found

Hi Everyone,

I have found a new website that is growing slowly called Byte Tutorials. I hope this new website helps you all with learning how to code PHP. I will be posting more soon.

Wednesday, February 10, 2010

Displaying the words "Hello World!"

Hello Everyone,

To begin open the text editor you have chosen to use. After you have opened it, start a new page and save it as helloworld.php inside the directory for the server you as using.

Now we will type the code into the text editor for this page.

I will firstly show the code you will put in, then explain how it works.

<?php

echo "Hello World!";

?>

Now to explain the code.
The opening PHP Tag is shown first. The opening PHP Tag is used to tell the browser that the following code is PHP.
The next line contains the word echo, which displays text on the browser, in this instance it displays the text shown between the " ". At the end of that line there is a semicolon. A semicolon is used to denote the end of a line of code.
Lastly the last line is the closing PHP Tag, which is used to tell the browser where the end of the PHP code is.

Now you open the file stored on the server, via a web browser. When using XAMPP it would be http://localhost/Location-Of-File

Hello world! should now be displayed on the browser.

Sunday, February 7, 2010

Installing a local server for PHP Testing purposes

Hello everyone,

A local server on you computer is very handy for testing purposes. It allows you to test your website, before it goes live to the public. However, some features may need to be tested on a live website if your local server can not handle them.

Apache (totally free) is a good server for testing PHP code on your computer. When you become better at PHP you might go into the realm of databases such as MySQL, and you will require a database for you local server so you can test database operations.

So, I would recommend XAMPP which is totally free like Apache but self installs itself, which a MySQL database as well. This saves you the time of trying to install these services separately. It would only take a few minutes after you click install, and it will be installed on your computer.

On most Windows based computers XAMPP will be installed in a folder called "XAMPP" on your C Drive, or which ever hard drive was selected in the installation. Open the "htdocs" folder from within the "XAMPP" folder and thats where you put your PHP website files, and other files required for your website to run.

To run your website after you have put the files necessary into the "htdocs" folder, open Internet Explorer, Firefox or another internet browser, and type into the address bar the website called http://localhost then press "enter". The website should now load up.

Please Note: The default webpage within the "htdocs" folder when the website http://localhost is opened. The default webpage is most commonly a file similar to the following:
  • index.htm
  • index.html
  • default.htm
  • default.html
  • index.php
  • default.php
other options exist for default webpages but they are some of the main ones.

Good Luck!

Don't forget comment if you have questions, or statements.

Friday, February 5, 2010

What program can I use to write PHP Code?

Programs you can use to write PHP Code are programs like notepad and notepad++, which are text editors.

PHP Files and Embedding PHP into HTML files

Hello Everyone,

When making a PHP file the filename should be in the form "filename.php".
Note: The PHP tags still must be used when using a PHP file and the PHP code must be put within these tags.

PHP can also be embedded into a HTML file. All that you need to do is put the PHP tags     in where u need PHP code and put your PHP code in between them.

Thursday, February 4, 2010

What must each piece of code in PHP end with?

Hi Everyone,

EVERY piece of code in PHP must end with a ; (Semi-Colon). Pieces of PHP code may spread over many lines.

PHP Tags

Hello Everyone,

For the browser to recognize PHP code, the code must Always be put between the PHP tags. These tags are:

<?php

?>

The PHP code should be put in between those tags. Now the browser will recognize the PHP code. If the PHP code is not recognized it will display it as it does with ordinary HTML code.

PHP code can not be recognised due to:

1. Webserver does not have PHP support.
2. PHP tags are not used or incorrectly used.