Monday, June 20, 2011

how to start php : step by step.

============================================
Before we can do the big fancy stuff we must first learn the basics from which we build on.
Start by creating a blank file using any program that can save in plain text format.
==>open note pad
==>Save as .php file for example testpage.php
==>enter the following code :


==> here " echo"Bismillah" indicates print the word "Bismillah"
==>"?>" indicates end point of php tags.
Comments in PHP

In PHP, we use // to make a single-line comment or /* and */ to make a large comment block.

for example:


//This is a comment

/*
This is
a comment
block
*/
?>
One reason you may want to put a comment in your code is to make a note to yourself about what the code is doing for reference when you edit it later. You may also want to put comments in your code if you plan on sharing it with others and want them to understand what it does, or to include your name and terms of use within the script.

how to install

If your server supports PHP you don't need to do anything.

Just create some .php files in your web directory, and the server will parse them for you. Because it is free, most web hosts offer PHP support.

However, if your server does not support PHP, you must install PHP.
Here is a link to a good tutorial from PHP.net on how to install PHP5: http://www.php.net/manual/en/install.php

Download PHP

Download PHP for free here: http://www.php.net/downloads.php

Download MySQL Database

Download MySQL for free here: http://www.mysql.com/downloads/

Download Apache Server

Download Apache for free here: http://httpd.apache.org/download.cgi


Or you can Install wamp which contains whole php,apache,mysql So now we can say Installing PHP is easy. You can install PHP on your computer easily with WAMP5. WAMP5 is an open source application which comes with with PHP5, Apache web server, MySQL database and phpMyAdmin (mysql database administration program). You can install these items on your windows machine using WAMP5. You can read more about WAMP5 at www.wampserver.com.

Installing WAMP5

  1. Download the latest version of WAMP5.
  2. Run the installation wizard and follow the easy instructions to install WAMP5.
  3. Once you're done installing WAMP5, please go to your folder where you installed wamp5. If you didn’t specify which folder to install wamp during the installation wizard, then it should be installed in your C:/ drive, i.e. C:/wamp.
  4. In your wamp directory you should see the following folders.
    1. apache2 – This is where the apache web server is installed. Apache will run our php code and scripts on the web browser. You will not need to do anything in this folder. So you can relax and ignore it for now:)
    2. mysql – This is where MySql databse is installed. MySQL is an open source database. PHP and MySQL work really well together. You can use PHP and MySql to store data. Don’t worry, we will learn how to do all that in our tutorials.
    3. php – You guessed it. This is where php modules are stored.
    4. www – This is the root folder of our web server. This is where you are going to put all your php files and scripts.
    5. wampserver.exe – This file will run the WAMP program. We need to start WAMP everytime we want to work with PHP. So, go ahead and double click on this file.
  5. Once you run the wamp server file, you will see a small icon on your windows tray.
    wamp tray icon

    Right click on this icon and then click on “Start All Services”. This will start the apache web server along with everything we need to run PHP pages on our machine.
  6. wamp start

    That it! You’re almost done.
  7. Now open up your web browser and type in http://localhost. You should see the WAMP welcome page.
  8. When you type in http://localhost in your browser, it executes the index.php file in your www folder. All our php files will go in the www folder. Follow the next tutorials to see how that is done.

You have done



Sunday, June 19, 2011

Basic Knowledge about php,mysql

What is PHP?
PHP stands for PHP: Hypertext Preprocessor
PHP is a server-side scripting language, like ASP
PHP scripts are executed on the server
PHP supports many databases (MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, Generic ODBC, etc.)
PHP is an open source software
PHP is free to download and use
What is MySQL?

MySQL is a database server
MySQL is ideal for both small and large applications
MySQL supports standard SQL
MySQL compiles on a number of platforms
MySQL is free to download and use

PHP + MySQL

PHP combined with MySQL are cross-platform (you can develop in Windows and serve on a Unix platform)

Why PHP?

PHP runs on different platforms (Windows, Linux, Unix, etc.)
PHP is compatible with almost all servers used today (Apache, IIS, etc.)
PHP is FREE to download from the official PHP resource: www.php.net
PHP is easy to learn and runs efficiently on the server side

Where to Start?

To get access to a web server with PHP support, you can:

Install Apache (or IIS) on your own server, install PHP, and MySQL
Or find a web hosting plan with PHP and MySQL support

Tuesday, September 28, 2010

SITE MAP

http://php-mysql-shiko.blogspot.com

http://php-mysql-shiko.blogspot.com/

http://php-mysql-shiko.blogspot.com/2009/11/my-first-project-web-based-calendar.html

http://php-mysql-shiko.blogspot.com/2009/07/learn-php-mysql.html

http://php-mysql-shiko.blogspot.com/2010/06/stringmatching-patterns-regular.html

http://php-mysql-shiko.blogspot.com/2009/11/var-skin-skinbordercolor-cccccc.html

http://php-mysql-shiko.blogspot.com/2009_11_01_archive.html

http://php-mysql-shiko.blogspot.com/search?updated-min=2009-01-01T00%3A00%3A00-08%3A00&updated-max=2010-01-01T00%3A00%3A00-08%3A00&max-results=3

http://php-mysql-shiko.blogspot.com/2009_07_01_archive.html

http://php-mysql-shiko.blogspot.com/search?updated-min=2010-01-01T00%3A00%3A00-08%3A00&updated-max=2011-01-01T00%3A00%3A00-08%3A00&max-results=1

http://php-mysql-shiko.blogspot.com/2010_06_01_archive.html

http://php-mysql-shiko.blogspot.com/feeds/posts/default

http://php-mysql-shiko.blogspot.com/search?updated-max=2010-06-26T01%3A15%3A00-07%3A00&max-results=1&reverse-paginate=true

http://php-mysql-shiko.blogspot.com/search?updated-max=2009-11-14T04%3A00%3A00-08%3A00&max-results=1

http://php-mysql-shiko.blogspot.com/search?updated-max=2009-11-25T12%3A28%3A00-08%3A00&max-results=1

http://php-mysql-shiko.blogspot.com/search?updated-max=2009-11-25T12%3A28%3A00-08%3A00&max-results=1&reverse-paginate=true

http://php-mysql-shiko.blogspot.com/search?updated-max=2009-11-14T04%3A00%3A00-08%3A00&max-results=7

http://php-mysql-shiko.blogspot.com/feeds/785005919568808962/comments/default

http://php-mysql-shiko.blogspot.com/feeds/2068277720800017559/comments/default

http://php-mysql-shiko.blogspot.com/feeds/7583099960475159973/comments/default

http://php-mysql-shiko.blogspot.com/feeds/8690610527471527235/comments/default

http://php-mysql-shiko.blogspot.com/search?updated-max=2010-06-26T01%3A15%3A00-07%3A00&max-results=1

http://php-mysql-shiko.blogspot.com/search?updated-max=2010-06-26T01%3A15%3A00-07%3A00&max-results=7

Saturday, June 26, 2010

@@String::::....Matching Patterns (Regular Expressions)

PHP includes a couple of different sets of regex functions that you can use. The one we will use exclusively here is the PCRE extension. The PCRE functions (all prefaced by preg_) is the preferred library to use. It tends to be faster than the other option, and it uses the same regex syntax as Perl, another popular programming language that many programmers are already familiar with.

To best demonstrate the usefulness of regular expressions, let's examine a relatively simple problem: searching for a United States ZIP Code. Such numbers are either a five-digit number, or are known as a ZIP+4 and look like "12345-6789." Attempting this search with the standard PHP string functions would require a multiline algorithm. However, with regular expressions, a single function, preg_match(), is all that is required, here's given example :

// A function to detect zipcodes in a string.
function detect_zipcode($string) {
// Use regex to look for zipcodes, return true or false
return preg_match('/\b\d{5}(-\d{4})?\b/', $string);
}

// Try a few examples:
echo '
';


// A true example:
if (detect_zipcode('Frederick, MD 21701-3883')) {
echo "Test 1: true\n";
}
// Another true example:
if (detect_zipcode('The zipcode 26623 is the area in which I grew up.')) {
echo "Test 2: true\n";
}
// A False example:
if (detect_zipcode('The Phone Number is 301-555-1212')) {
echo "Test 3: true\n";
}
// Another false example:
if (detect_zipcode('42696-313109')) {
echo "Test 4: true\n";
}

echo '
';
?>



OUTPUT:

As a quick reference, here are some of the most common syntax characters for use in PCRE regular expressions:

Pattern matches:

\d = Digit

\D = Not a digit

\s = Whitespace

\S = Not whitespace

. = Any character (except \n)

^ = Start of string

$ = End of string

\b = Word boundary

Pattern match extenders:

? = Previous item is match 0 or 1 times.

* = Previous item is matched 0 or more times.

+ = Previous item is matched 1 or more times.

{n} = Previous item is matched exactly n times.

{n,} = Previous item is matched at least n times.

{n,m} = Previous item is matched at least n and at most m times.

? (after any of above) = Match as few as possible times.

Option patterns:

(pattern) = Groups the pattern to act as one item and captures it

(x|y) = Matches either pattern x, or pattern y

[abc] = Matches either the character a, b, or c

[^abc] = Matches any character except a, b, or c

[a-f] = Matches characters a through f

If you want to learn more try to read http://php.net/pcre.

Cleaning Up Whitespace...::--

If you want to just remove space from the beginning or end of a string, you can use the built-in function trim() to do that for you. However, often you want to completely clean up the data. You will want to remove leading/trailing spaces, collapse multiple spaces into a single one, and even replace all other types of whitespace with a regular space.

To accomplish this, you can use the regular expression functions of PHP as like as below:

$str = " This line  contains\tliberal \r\n use of   whitespace.\n\n";


// First remove the leading/trailing whitespace
$str = trim($str);

// Now remove any doubled-up whitespace
$str = preg_replace('/\s(?=\s)/', '', $str);

// Finally, replace any non-space whitespace, with a space
$str = preg_replace('/[\n\r\t]/', ' ', $str);

// Echo out: 'This line contains liberal use of whitespace.'
echo "
{$str}
";
?>

OUTPUT:
This line contains liberal use of whitespace.

Section 1.1. Matching Patterns (Regular Expressions)


Wednesday, November 25, 2009






Saturday, November 14, 2009

PHP Internals

1 Strings
2 Numbers
3 Time and Date
4 Variables
5 Arrays
6 Functions
7 Classes and Objects
8 Files and Directories


1 Strings:
Quick learn:
Find the length of a string:

$length = strlen($string);
This function returns the number of characters in a string.

Full documentation: http://php.net/strlen

Split a string using a string as a separator:

$array_of_strings = explode($separator, $string);
This function returns the array of substrings created by splitting a string at every point the separator string appears.

Full documentation: http://php.net/explode

Create a string from an array of strings, with a separator:

$string = implode($separator, $array_of_strings);
The returned string will be a concatenation of all the strings in the array, with the separator string between them.

Full documentation: http://php.net/implode

Remove extra space from the beginning and end of a string:

$trimmed_string = trim($string);
The returned string will have any whitespace characters removed from the beginning and end of the string. The functions rtrim() and ltrim() remove whitespace from only the right or left end of the string, respectively.

Full documentation: http://php.net/trim, http://php.net/rtrim, and http://php.net/ltrim

Replace all occurrences of one string with another string:

$result_string = str_replace($old, $new, $full);
All occurrences of the old string within the full string are replaced with the new string. A case-insensitive version is also available as the function str_ireplace().

Full documentation: http://php.net/str_replace and http://php.net/str_ireplace

Pad a string to a specified length:

$padded = str_pad($string, $length);
The returned string is at least $length characters long. Spaces are added to the right of the string to achieve this. With optional arguments, any string can be used as padding along with whether the padding will occur at the beginning or end of string.

Full documentation: http://php.net/str_pad

Create a larger string via repetition:

$repeat = str_repeat($string, $nrepeats);
The input string is replicated the specified number of times to create the result.

Full documentation: http://php.net/str_repeat:

Split a string into an array of characters

$array = str_split($string);
This function returns an array comprising the characters that make up the string.

Full documentation: http://php.net/str_split

Return a portion of a string:

$substring = substr($string, $n, $length);
The portion of the string starting at the nth character for $length number of characters is returned. If $n is negative, the substring will start that many characters from the end of the string. If $length is negative, that many characters will be omitted from the end of the string.

Full documentation: http://php.net/substr

Make a string all uppercase or lowercase letters:

$lower = strtolower($string);

$upper = strtoupper($string);
These functions simply return, respectively, the lowercase or uppercase versions of the string.

Full documentation: http://php.net/strtolower and http://php.net/strtoupper

Parse a string based on a format:

$array = sscanf($string, $format);
The returned array contains each extracted value from the string according to the specified format.

Full documentation: http://php.net/sscanf

Output values using well-defined formats:

printf($format, $var1, $var2,...);
Using a simple syntax, the format argument defines how the subsequent arguments are printed. This function is part of a family of formatting functions.

Full documentation: http://php.net/printf, http://php.net/sprintf, http://php.net/fprintf

Compare two strings:

$result = strcmp($string1, $string2);
This function returns a number less than, equal to, or greater than 0 depending on how the strings compare alphabetically. 0 is returned if the strings are equivalent. A case-insensitive version is also available as strcasecmp().

Full documentation: http://php.net/strcmp and http://php.net/strcasecmp

Compare two strings as a human would do so:

$result = strnatcmp($string1, $string2);

$result = strnatcasecmp($string1, $string2);
The comparison is based on how people order stringsthat is, strings with numbers in them are ordered based on value, not just characters. The comparison is case-sensitive for the former call while being case-insensitve for the latter.

Full documentation: http://php.net/strnatcmp

Determine where the first occurrence of a string is within another string:

$pos = strpos($bigstring, $search);
This function returns the position of the search string in $bigstring. If not found, false is returned. A case-insensitive version is also available as stripos().

Full documentation: http://php.net/strpos and http://php.net/stripos

Determine where the last occurrence of a string is within another string:

$lastpos = strrpos($bigstring, $search);
This function returns the position of the last occurrence of the search string in $bigstring. If not found, false is returned. A case-insensitive version is also available as strripos().

Full documentation: http://php.net/strrpos and http://php.net/strripos

Search for any of a set of characters within a string:

$found = strpbrk($string, $characters);
The string is scanned for any of the characters in the $characters string. If a match is found, it returns a string starting from the character it just matched to the end of the string.

Full documentation: http://php.net/strpbrk

facebook

International movers in newyork, Long distance movers in newyork, Automobile movers in newyork , Temporary storage, Moving supplies, moving overseas, international shipping, shipping, free quotes, moving quotes, moving company, international removals, removal company.Please visit here: baileysworldwide.com ====================================================== debris removal in nyc, garbage removal in nyc, debris removal in queens, demolition removal in queens, garbage removal in queens, garbage removal in New York.Please visit here : Richmond HILL demolition & garbage removal ======================================================= NYC work permit, NYC violation removal, Alt I, Alt II, Alt III filings,(interior, commercial build outs), New Building, Builders Pavement Plan (BPP), Sign applications, Sprinkler Fire alarm applications, Place of Assembly, Temporary Place of Assembly, Stop Work Order Removal. Please visit here : chameleonexpediting.com