on Sunday, November 11, 2012

Mysql Insert using form

For creating dynamic pages it is so important to know how data is inserted in mysql data base.

Example --à

// save as form.php or form.html
<html>
<head><title>connection through form action</title></head>
<body>
<form action=”insert.php” method=”POST”>
 //here we can use method=”GET”
//GET is use for passing variables through address bar whereas POST method doesn’t show         any pass in url or address bar.
// form fields like input box and buttons etc...
<input type=”text” id=”name” name=”name” />
<input type=”text” id=”age” name=”age” />
</form>
</body>
</html>

MySql DB connection

Now I am going to tell You how to stabilise a connection with DB.
Syntax:             
mysql_connect(nameofserver,username,password);

Exapmle

mysql_connect(“localhost”,”root”,””) or die (“not connected”);
// localhost is use for local server
You can do it by other way also
$myhost=”localhost”;
$username=”root”;
$password=””;
mysql_connect($host,$username,$password) or die (“not connected”);

NOW , How to connect with database

Syntax:
First stabilise  the connection with server
mysql_connect(“localhost”,”root”,””) or die (“not connected”);
mysql_select_db(“myDb”) or die(“db not connected”); 

POST:

‘POST’ is used for the value sending . the values sent that aren’t  appears in url bar.Generally used for login and security.

Here I am going to give an example try it.
// save the below given as “test.php”

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>my post method</title>
</head>

<body>
<form action="action.php" method="post" name="passing value by post">
<label>Enter Name</label>&nbsp; :<input name="name" type="text" />
<br />
<label> Enter Age</label>&nbsp; :<input name="age" type="text" />
<br />
<input type="submit" value="Submit" />
</form>
</body>
</html>
on Thursday, November 8, 2012

GET

‘GET’ is used for the value sending . the values sent that are appears in url bar.
Here I am going to give an example try it.

// save the below given as “test.php”

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>my Get method</title>
</head>

<body>
<form action="action.php" method="get" name="passing value by get">
<label>Enter Name</label>&nbsp; :<input name="name" type="text" />
<br />
<label> Enter Age</label>&nbsp; :<input name="age" type="text" />
<br />
<input type="submit" value="Submit" />
</form>
</body>
</html>

Functions

The beautiful of PHP is the functions of PHP. Come to the types of functions ,
Types of PHP functions, we dividing here

1)User Defined functions
2)PHP In-built Functions.
                a) frequently used functions
                b) less-frequently used functions

1)User Defined Functions
  You can defined your function according to your use

Syntax:
// without passing argument
function  myfunction()
{
echo “hello , I am in function without arguments”;
}
myfunction();     // calling the function
Outut :
Hello , I am in function without arguments

for-each loop

Some of us have the question that why we use for-each when we have already for loop.
So that the answer is for-each loop is used for the array, but how?

Coming to the Syntax:
foreach($arrayname as $value)
{
// code for execution
}
EXAMPLE
$myname=array(“softfive”,”soft”)
foreach($myname as $value)
{
echo $value.” , “;
}
Output
Softfive , soft

on Saturday, November 3, 2012

PHP Loops

Loops having a great importance in any language.
      1)    If-else loop:-
If-else loop used for the condition checking if condition is true then if executed otherwise else executed
Example shown below-
// loop starts
If (condition)
{
}
else
{
}

PHP Variables

A PHP variable starts with sign ‘$’ and variable name contains only
 ( _  , a-z , A-Z , 0-9 ).
(Note: PHP is a case sensitive. ‘a’ and ‘A’ are different names and don’t use spaces in variable name)
Some examples of variables are:-
$myname=”softfive”;
$_myname=”softfive”;
$1=”softfive”;

<html>
<head></head>
<body>

PHP Basics

Before starting PHP you should know about HTML ,scripting and the basics of PHP.
Example of PHP application is www.facebook.com .

Now coming to topic,

The first question arises in your mind what is PHP and PHP stands for What?
The answer is PHP HYPERTEXT PREPROCESSOR .

PHP is server side scripting language i.e. you need a server to run the PHP code.

Now the questions comes to extension of PHP,
The extension of PHP are .phtml , .php , .php3.
You can use any of above three for PHP.

When you are concerning with web application then you should aware with the presentation of web pages that uses HTML for the presentation.
Placement papers (Free Download Here)

IBM Papers

sample 1 sample 2 sample 3 sample 4

INFOSYS Papers

sample 1  sample 2  sample 3 sample 4

Note: there are mainly two rounds in Infosys first is aptitude and second is HR . Aptitude round contains two section English and quantative &amp; reasoning. If  you are not qualify in English section then your quantative section will not consider.
Syllabus and questions of elitmus pvt Ltd

There are three section each section of 200 marks.
SECTION A-QUANTITATIVE
SECTION B-REASONING
SECTION C-VERBAL
QUANTATIVE (20 QUESTIONS)
In this section the questions like
1) 101+102+............. find the max sum upto temrs 99

2) can be answer by
If n2-n-6 =0 ,n=positive
a)n=-2
b)n=3
c)both

3) In year 2011 there are several student given the e-litmus . out of them 98 percentile student got interview call and those of them 75 % accepted their call . out of them 80% go for interview and the ratio of selection and rejection is 1:4 if there are 100 student are selected then find out the no of students appeared in e-litmus exam..(MUST)

4) If there is a cubical tank and there are 10 pipes that will used to fill and empty the tank.
If 6 pipes fill the tank in 4 hours and 7 pipes empty the tank in 2 hours. then find 9 pipes fill the tank in how much time if 3 pipes are open...
Overview (for CSE/IT/MCA) :

There are mainly five sections in AMCAT, these are VERBAL, QUANTATIVE, TECHNICAL (Programing output basis) , PERSONALITY, C++/JAVA/SQL. NO NEGATIVE MARKING

I)Verbal
In verbal section there are no fix number of questions these are approx 20-25 questions.

II)Quantative
In this section no fix questions its lies between 20-40 questions.

III)Technical
This section also having no fix questions lies between 20-35 programing code basis.

IV)Personality
This section is looking lengthy but its easy and no need to prepare questions are more than 60.
E.g.- U like to spread jokes between your friends-
a) very incorrect b)some incorrect c)mostly correct d)very correct.