PHP Programming 101

May 30th, 2008

PHP BASIC CODING (cont…)

(cont….)

V. Operators in PHP

*Arithmetic Operators*

+ addition
- subtraction
* multiplication
/ division
% modulus (division remainder)
++ increment
– decrement

*Comparison Operators*
== equal to
!= not equal
> greater than
= greater than or equal
<= less than or equal

*Logical Operators*
&& and
|| or
! not

I know its self explanatory…

VI. IF….Else Statements

If (condition)
//*Things to be executed if the answer to the condition is true*//
else
//*Things to be executed if the answer to the condition is false*//

If…else statement is use if the user wants to execute a set of code when the condition is true and another if the condition is not true.

VII. Switch Statement

switch (expression)
{
case 1:
//*code to be executed*//
break;
case 2:
//*code to be executed*//
break;
default:
//*code to be executed*//
break;
}

Switch statement is use if you want to select one of many blocks of code to be executed. this statement is used to avoid long blocks of if…elseif..else.

VIII. Looping Statement

while(condition)
code to be executed;

While statement is used to execute a block of code if and as long as a condition is true

do
{
code to be executed;
}while (condition)

Do—while statement is used to execute a block of code at least once and it will repeat the loop as long as the condition is true.

for each (array as value)
{
code to be executed;
}

For each statement is used to loop through arrays.

I think this is already enough and it has added new knowledge to those who are new in PHP… good luck and happy coding…

php_2.jpg

image source: www.cass.rrhosting.com

May 29th, 2008

PHP BASIC CODING (cont…)

(cont…)
III. PHP Variables

$variablename=value;

Variables are used for storing values such as text string or arrays. And all variables in PHP starts with a ($) dollar sign. There are various rules to be follow before naming a variable. 1) A variable name must start with a letter or an underscore. 2) A variable name can only contain alpha-numeric characters and underscores. Special characters are not allowed. 3) A variable name should not contain spaces.

IV.PHP Strings

$wrd=”Hello World”;
print $wrd;

Strings variables are used for values that contain character strings. The only operator that can be used on string is concatenation denoted by the sign (.) period.

$wrd1=”Hello World”;
$wrd2=”Good day”;
print $wrd1.”".$wrd2

You can count the nos. of string with the function strlen().

Print strlen(”HelloWorld and GoodDay”);

to be continued…

php-designer3php-editorscom.jpg

image source: www.php-editors.com

May 23rd, 2008

PHP BASIC CODING

Here are some of the basic things to be in mind while coding your dynamic web pages using PHP.

I. PHP basic syntax

PHP is a script that is place inside a HTML document that’s why you need to put the basic codes of HTML such as and .
PHP is open with the (?)question mark followed by “PHP” and closed with a (?) question mark.

II. Displaying in PHP

In order to display a text in PHP you need to use the keyword ECHO or PRINT. all code line ends with a semicolon.

To be continued…

firefoxss23hqcom.jpg

image source: www.23hq.com

April 24th, 2008

Avoiding Spywares and Viruses

Posted by Edi in Uncategorized

by: Larla

Photobucket

Virus problems can be such a headache and could cost you money as well. How do we avoid these spyware and viruses?

Usually it is in what we download. Know what not to download meaning, pay attention and be careful on your downloads as they are usually the one containing viruses. You can do a virus scan first before downloading if possibles.

Keep windows up to date. Though it takes time as it is very slow, it helps prevent viruses.

Freewares are often bundles with spywares, so be careful.

Also, before opening flash drives, make sure to do a virus scan.

Hope this helps to keep your computer free from virus in more years to come.

April 19th, 2008

Understanding Cookies

Posted by Edi in Uncategorized

by: Larla

Photobucket

What exactly is a cookie? It’s not a food, in the computer world, a cookie is a small amount of information sent by a Web server to a web browser. They are sent back unchanged by the browser each time it accesses that server. They are used for tracking, storing, authenticating information regarding the users which include sites visited. They give capabilities that make the web easier to navigate. If you are using Microsoft’s Internet Explorer to browse, you can see all of the cookies that are stored on your machine. They are usually stored in a directory called c:\windows\cookies.

It is composed of a cookie name and cookie value. The setcookie function() can be used to send a cookie to a browser to request your PHP page.

March 31st, 2008

Writing HTML Forms

Posted by Edi in Uncategorized

by: Larla

Photobucket

For any web content developer, writing forms in html is a very beneficial skills that one should know. It allows users to submit and enter information. The info that users input are collected through html forms either via email or adding the info to the database.

First, create the form in a word program as you can easily convert it to html forms directly.

The form must start with < form > and end with the < / form >. The common processing for programs are CGI, MySQL Perl and PHP. The programs must be available in the web server for the form data to be processed.

The < input > tag is used to generate info from users. This can be used with various form elements.

Form can be submitted into the system using < form method="POST" action=" " > tag.

Forms can be as short and simple as questions by email or as complicated as a hundred page survey.

March 15th, 2008

Good Domain Name (Part 2)

Posted by Edi in Uncategorized

by: Larla

Photobucket

4. Plurals, “The”, and “My” Forms of the Domain Name
If you have a domain name in mind but it is already taken, you can have alternate forms of the name using my, the or possibly a plural for example, if you want car.com but it is no longer available you can possibly have mycar.com, thecar.com, cars.com.
If you plan on going for these kinds of domain name, promote your site beforehand as usually people will tend to forget the affix (the,my) when doing searches.

5. .ORG, .NET etc.?
If you are using a domain other than that of .com, same thing for using affixes, promote you site as people are more familiar with .com and would most likely do these when searching for websites.
It is also good to have a local domain name like .co.uk, if your business is in the UK or .co.in for India.. You can benefit from these as people in the particular country knows that they are dealing with a local company.

The domain name should be easy to remember and something that would stick in people’s mind.

February 29th, 2008

Good Domain Name (Part 1)

Posted by Edi in Uncategorized

by: larla

Photobucket

Before choosing a domain name, consider the following:
1. Domain Name as your website Name
It is important to name your site after your domain name so that when people think of your website, they’ll remember it by name. If it is also your URL then it is much more easier to remember. Your domain name should reflect your site or business.

2. Brand Name Domains
Domain name that matches your brand name is better as usually if people are thinking of buying something they already have a particular brand in mind.

3. Hyphenated Names
Hyphens in websites are usually easier to forget. But if you really want a particular domain name but it is already taken, with a hyphen you can shave the domain name you want.