Displaying posts categorized under

Open Source Programming

Simple MySql Select Query with PHP Program

<?php/* * Author : Antony * Created on 05-Feb-08 * Program Name : MySqlSelectFromDatabase.php */ //initilaize the mysql user name and oassword $user=”root”; $password=”123456″; //database name $database=”studentinfo”; //get the information from bookdetails form $isbn=$_POST['isbn']; //connect the mysql database $link=mysql_connect(localhost,$user,$password); @mysql_select_db($database) or die(“Unable to Open Databse”); //execute the query $sql =”SELECT * FROM bookdetails WHERE isbn [...]

Login Form With MySql Database

1. Login.html <!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”> <!– * Created on 21 Dec 2006 * Author : Antony –> <html> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″> <title>Login Page</title> </head> <body> <form action=”login.php” method= “post”> <br /> <br /> <br /> <br /> <br /> <table bgcolor=”#4C0068″ border=”0″ align=”center” valign=”middle” cellspacing=”1″ cellpadding=”10″ width=”40%” summary=”pagedesign”> [...]

PHP Cookie – Simple Example

Constraints 1. Diplay the login form with check box2. a) If username and password are correct and check box is not selected then display Welcome message b) When user refresh the page or again type address(url) display the login form 3. a) If username or password are not correct and check box is not selected [...]

File Uploading in PHP

Necessary Functions and Variables 1. $_FILES Global Variable Atrributes a) $_FILES['userfile']['name'] -> return the name of the file b) $_FILES['userfile']['type'] -> return the type of the file File Types 1.Microsoft Word Document => application/msword 2.Microsoft Powerpoint => application/vnd.ms-powerpoint 3.Open Office Document => application/octet-stream 4.PDF files => application/pdf 5.JPEG Image => image/jpeg 6.GIF Image => image/gif [...]

PHP Basics – Looping Statements

1.While Loop <?php/* * Author : Anthoniraj * Created on Jan 8, 2008 * Program Name : 11whileloop.php */ //Formal While loop $x=1; while ($x<=10) { echo “The Value of X is $x <br>”; $x++; } //Alternate Syntax $z=10; while ($z>0): echo “The Value of Z is $z <br>”; $z–; endwhile; ?> 2.Do-While Loop <?php/* [...]

PHP Validation Using ereg() Function

<?php /* * FileName:validation.php * Created on Jan 16, 2007 * Author:Antony */ function validateUname($uname) { if (ereg(‘^[a-zA-Z0-9_]{3,50}$’, $uname)) return true; else return false; } function validatePassword($pwd) { if (strlen($pwd) >= 6) return true; else return false; } function validateEmail($email) { if (eregi(‘^[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$’, $email)) return true; else return false; }function validateDate($date) { if (ereg(‘(^[0-9]{1,2})-[0-9]{1,2}-([0-9]{4}$)’, $date)) [...]

PHP Basics – Conditional Statements

1. Simple If Condition <?php/** Author : Anthoniraj* Created on Jan 8, 2008* Program Name : 06ifcondition.php*/$a = 10;$b = 20;if($a > $b) { echo “A is bigger than B”; }echo “The value of A is $a<br>”;echo “The value of B is $b”;?> 2. If-Else Condition <?php/** Author : Anthoniraj* Created on Jan 8, 2008* [...]

PHP Basics

1. PHP Simple Program Structure <?php/** Author : Anthoniraj* Created on 30-Dec-07* Program Name : 01pgmstructure.php*/while(1){echo “PHP is a server-side scripting language”;break;}?> 2. String Handling <?php/* * Author : Anthoniraj * Created on 03-Jan-08 * Program Name : 02string.php */ include “check.php”; echo “Hello Antony”; echo ‘<br>”I\’ll be there at 10″‘; ?> 3.Array Manipulation <?php/* [...]

MySql Queries – Explained

anthoniraj@VITSCS0197:~$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 7Server version: 5.0.45-Debian_1ubuntu3-log Debian etch distribution Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer. mysql> show databases;+——————–+| Database |+——————–+| information_schema | | mysql | | sample | +——————–+3 rows [...]

Open Source Software Development With LAMP

All of u known very well , PHP , MYSQL, Apche are the technologies which is used for developing Web Application . These are free softwares , freely downlodable, but the configuration of Separate packages like php.ini file is somewhat difficult . SolutionLAMP (L- >Linux , A->Apache , M-> MySql , P->PHP) is one of [...]