Skip to main content

Posts

Showing posts with the label PHP

PHP String Variables tutorial

A string variable is used to store and manipulate text. String Variables in PHP String variables are used for values that contain characters. In this chapter we are going to look at the most common functions and operators used to manipulate strings in PHP. After we create a string we can manipulate it. A string can be used directly in a function or it can be stored in a variable. Below, the PHP script assigns the text "Hello World" to a string variable called $txt: <?php $txt="Hello World"; echo $txt; ?> The output of the code above will be: Hello World Now, lets try to use some different functions and operators to manipulate the string. The Concatenation Operator There is only one string operator in PHP. The concatenation operator (.)  is used to put two string values together. To concatenate two string variables together, use the concatenation operator: <?php $txt1="Hello World!"; $txt2="What a nice day...

Variables in PHP - Create, Assign, Display

A variable is used in PHP scripts to represent a value. As the name variable suggests, the value of a variable can change (or vary) throughout the program. Variables are one of the features that distinguish a programming language like PHP from markup languages such as HTML. Variables allow you write your code in a generic manner. To highlight this, consider a web form which asks users to input their name and favorite color. Every time the form is completed, the data will be different. One user may say his name is John and his favorite color is blue. Another may say her name is Susan and her favorite color is yellow. We need a way of working with the values a user enters. The way to do this is by using variables. There are a few standard variables that PHP creates automatically, but most of the time variables are created (or declared ) by you, the programmer. By creating two variables called $name and $color , you could create generic code which can handle any input va...

PHP Part 2: PHP Installation

What do you Need? 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

How to send Email Using PHP

Sending emails using php on your web-server is not such a big task if you are familiar with basic functions of PHP. You can write a mail function and provide subject, message as parameter to it. This mail function is inbuilt and your can use it by using the keyword  main() in your code. How to use Mail() function in PHP? Open your PHP file in any editor such as Notepad . If you dont have any existing PHP file, then create new PHP file and start writing the code given below one by one while understanding its use. Mail to Variable: $email="email_addressof_the_person_you_want_to_send_mail@domain.com"; The variable " $email " is used to store the address of the person who will recieve the email. Subject Variable: $subject="SUBJECT OF THE E-MAIL"; We will use this variable " $subject " to store the value for e-mail. Here I have given the value itself as " SUBJECT OF THE E-MAIL " for simplicity. Message Variable: $message=...

PHP Tutorial Start Learning From Today.. INTRODUCTION..

Introduction   PHP is a powerful tool for making dynamic and interactive Web pages. PHP is the widely-used, free, and efficient alternative to competitors such as Microsoft's ASP. In our PHP tutorial you will learn about PHP, and how to execute scripts on your server. Before you continue you should have a basic understanding of the following: HTML/XHTML JavaScript About 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 a PHP File? PHP files can contain text, HTML tags and scripts PHP files are returned to the browser as plain HTML PHP files have a file extension of ".php", ".php3", or ".phtml" What is MySQL? MySQL is a database server MySQL is ideal for both s...

(Project) Designing and Building a Simple Search Engine with PHP, MySql

I hope this will encourage you to develop an engine that suits your particular needs, with the exact features you desire. Database Design and Logic We'll use MySQL as a database backend to store our search data. It's possible to shell out to Unix commands such as grep and find, but that would mean running the search engine on the machine hosting the files. As well, it would be more difficult to index pages served from a database. We'll tackle the database first. The database for the search engine consists of three tables: page, word, and occurrence. page holds all indexed web pages, and word holds all of the words found on the indexed pages. The rows in occurrence correlate words to their containing pages. Each row represents one occurrence of one particular word on one particular page. The SQL for creating these tables are shown below. CREATE TABLE page (    page_id int(10) unsigned NOT NULL auto_increment,    page_url varchar(200) NOT NULL default '', ...