php - notes
DESCRIPTION
notes about web developing phpTRANSCRIPT
HTML
HTML is a not a scripting language or programming language But it is a simply markup language .this markup language with the pair of markup tags. The firstTag is known as opening tag (or) starting tag. The second tag is known as closing (or) end tag.HTML are used to describe the web pagesHTML can be written in notepad, notepad++, dream viewer, adov and cs5 HTML file can be saved with .html as its extensionThe look end of an web page should be same on the all browsers. If it is not same the cross browser compatibility
Tags in html: -Heading tags are h1, h2...h6Ex: - welcome to html
. . welcome to html: - this tag is used for horizontal line
: - this tag is used for break: - this tag is used for paragraph
content: - this tag is used for bold content: - this tag is
used for italic content: - this tag is used for connect the style
sheets: - this tag is used for JavaScript: - this tag is used for
big content: - this tag is used for strong content: - this tag is
used for blink content: - this tag is used for delete the content:
- this tag is used for strike : - this tag is used for underline
content: - this tag is used for insert content: - this tag is used
for quotation content: - this tag is used for super contentEx: -
(a+b) 2: - this tag is used for subscript contentEx: - h2oEntities:
-Entities are used to describe the symbols (or) special characters
on to the web page. We have certain symbols are not available on
the keyboard. So such symbols can be inserting through entities. We
have mainly two types of entities they are1. Named Entity2. Number
Entity1. Named Entity: -Syntax: - Ampersand + entity name +
semicolonEx: -$2. Number Entity: -Syntax: - Ampersand +
hash + ascci value+ semicolonEx: - A =>A =>Trademark: tm List
Tags: -List tags are two types1. Order list: - Grouping of elements
in the form of order wise through number, upper alpha (A) lower
alpha (a), upper roman, lower roman is known as order listEx: -
Order list.htmlList TagsOrdered
ListNokiaMototolaLG-MobileSony2. Unorder list: -
Grouping of elements in the form of disk, square circle are known
as unorder listEx: - unorder list.htmlList TagsUnordered
ListPHPHTMLJOOMLAMySQLDefination ListTerms &
Conditionssome large text matter write here Definition list: - this
is used to maintain the heading the description on to the tag this
is dl Definition term: - definition term creates the
headingDefinition description: -which holds to the description of
the content this is ddDt and dd tags are both child tags of DLMeta
tag: - Meta tag is used generate the traffic on to your web page.
Meta tags can be embed into the head tag using Meta tag Meta tag
helps in search engine ranking on Google page and PTC(pay to
click)Ex: - Meta.htmlMeta TagsWe have changed our Website Name from
UTI Bank to AXIS Bank ... Sorry for incontinent Please wait for 5
sec it would be Automatically be RedirectedLink tags: - links are
used to navigate from one page to another page using inter (or)
external linksThe attributes we can pass areTarget = -blank // new
web pageTarget = -new // new web pageTarget = -self // open on same
pageLinks can also we target to mails and also we search the link
on same pageEx: - linktag.htmlLink TagsLinks NavigationGoogle page
|| Facebook Page || Tags ContentMail ConceptContact Us
Contact Support & AdminNavigating to Search the LinkFAQwhat is
html ?
what is php ?
what is joomla ?
what is ajax ?
what is mysql ?
what is jquery ?
what is java script ?
Answer 01: write here some large text matterBack to
TopAnswer 02: write here some large text matterBack to
TopAnswer 03: write here some large text matterAnswer
04: write here some large text matter Answer 05: write
here some large text matterImage tags: - images can be embed into
the body tag using image tag. Images have extension of jpg, png,
gif etcPlacing on image on to the web page can be done by two types
they are1. Absolute path: - working from the working directory you
can call the image from any ware with respect its parent directory
(or) out of the parent directory (or) external filesEx:-image
tagsimage tagsabsolute path2. Relative path: - using relative path
you can work with images on to the same current working directory
(or) sub folders did not out of your parent directoryEx: -image
tagsimage tagsrelation tags
Tables create: - tables are used to put down content in tabular
structure. Table tag can be embed into your body tag using table
row table data (or) content The general attributes that we can pass
in tables areBorder = Width = Height = Cell padding = Cell spacing
= Align = left/center/rightBackground = image pathFames =
box/group/lhs/rhs/above/below/vsides/hsidesRules =
all/middle/bottomColspan =Rowspan = Bgcolor = color nameEx: -table
createmployee detailsls.noNamedesignation1sureshphp programmerCell
padding: - cell padding is used to maintain the distance between
its content and from its wall (or) borderCell spacing: - cell
spacing is used to increase the wall (or) the borderFrame set: -
frame set we can divide the body into no of divisions that are
passed as an argument based on rows (or) cols working with frame
set you should ensure that body tag in not givenNote: - frame set
is a depreciated tag and would be working with feature versionsEx:
-Frameset TagsIframes: -Ex: -Iframes TagsList Page | Links
Page
Created registration form: - registration.htmlRegister FormNew
Registration FormFirst name:E-Mail:Password:Confirm Password:Gender
*: Male Female Hobbies: Playing Reading SingingCountry:Please
selectINDIAUSAUnited KingdomAddress:Image Upload: CssCss stands for
cascading style sheet. Css is used to put some styles (or) colors
on to the web page. Css can be embed into the html head tag using
style tag. There are mainly 3 different flavors to attach this
style on to the web page. Which are mainly1. Internal style sheet2.
External style sheet3. in-line style sheet1. Internal style sheet:
-An internal style sheet should be used when a single document has
a unique style. You define internal styles in the head section of
an HTML page, by using the tag, like this:hr {color:sienna;}p
{margin-left:20px;}body
{background-image:url("images/back40.gif");}2. External style
sheet: -An external style sheet is ideal when the style is applied
to many pages. With an external style sheet, you can change the
look of an entire Web site by changing one file. Each page must
link to the style sheet using the tag. The tag goes inside the head
section:An external style sheet can be written in any text editor.
The file should not contain any html tags. Your style sheet should
be saved with a .css extension. An example of a style sheet file is
shown below:hr {color:sienna;}p {margin-left:20px;}body
{background-image:url("images/back40.gif");}3. in-line style sheet:
-An inline style loses many of the advantages of style sheets by
mixing content with presentation. Use this method sparingly!To use
inline styles you use the style attribute in the relevant tag. The
style attribute can contain any CSS property. The example shows how
to change the color and the left margin of a paragraph:This is a
paragraph.We have one more style which is given by default by
browsers which is not editable External style sheet can be saved
with .css as its extensionSyntax: -(Attributes) element (or) class
(or) id {property: value ;}CSS SyntaxA CSS rule has two main parts:
a selector, and one or more declarations:The selector is normally
the HTML element you want to style.Each declaration consists of a
property and a value.The property is the style attribute you want
to change. Each property has a value.Selector: - selector are
identifiers which give styles based on elements, class (denoted by
period .), id (denoted by #) based on selectors we have Element
selector Class selector Class with element selector Id selector Id
with element selector Attribute selector Pseudo selectorElement
selector: -Ex: - element.htmlElement
Selectorh1{color:green;}Welcome to my WebsiteClass selector: -The
class selector is used to specify a style for a group of elements.
Unlike the id selector, the class selector is most often used on
several elements. This allows you to set a particular style for
many HTML elements with the same class. The class selector uses the
HTML class attribute, and is defined with a "."In the example
below, all HTML elements with class="center" will be
center-aligned:Ex: - class-selector.html & Class with element
selector: -Element Selectorh1{color:green;} //element
selector.x{color:red;} // class selector//.x{font-family:impact;}
p.x{font-size:20pt;color:black;} // Class with element
selectorWelcome to my WebsiteThis is new Website hello This is my
next line Hello my next pageRajeshId selector: -The id selector is
used to specify a style for a single, unique element.The id
selector uses the id attribute of the HTML element, and is defined
with a "#".The style rule below will be applied to the element with
id="para1":Ex: - id-selector.html & id with element
selectorElement Selectorh1{color:green;} //element
selector.x{color:red;} // class
selector//.x{font-family:impact;}p.x{font-size:20pt;color:black;}
// Class with element selector#g{background:green;} //id
selectorp#g{text-transform:uppercase;} //id with element
selectorWelcome to my WebsiteThis is new Website hello This is my
next line Hello my next pageRajeshAmithDavidPraveenKarthikAttribute
selector: -Ex: - attribute.htmlElement
Selector.x{color:deeppink;font-family:impact;}input[type='text']{color:deeppink;}Name
:
username :
Pseudo selector: -Ex: - pseudo.htmlElement
Selectorp:first-letter{font-size:30pt;color:deeppink;font-family:arial
black;}p:first-line{color:orange;}This is my first email to all you
guys his is my first email to all you guys his is my first email to
all you guys his is my first email to all you guys his is my first
email to all you guys Ex2: - pseudo2.htmlElement
Selectora{font-size:20pt;font-weight:bold;}a:link{color:red;}a:visited{color:green;}a:active{color:blue;}a:hover{color:deepskyblue;text-decoration:none;}Selector
| ElementsCss ex: -first css pageH1{color : green;} welcome to my
web site some large text matter this is my next element Css
sheat sheet: - Font-styles :- font-style :
italic,normalfont-variant : small-caps,narmal,small,caps(capital
letters)font-weight : normal,lighter,bold, bolder,
number(100->light, 900->bolder)font-size : px;font-family :
family of fontEx: -First CSS
Page.x{font-style:italic;font-variant:small-caps;font-weight:900;font-size:16px;font-family:courier
new;}//.y{font:normal normal 100 20pt courier new;}some large text
matter some large text matter Text properties:- 1. letter-spacing :
px2. word-spacing : px3. line-height : px4. text-align :
left/center/right/justify ->order from left (or) right5. text-
decoration : name, blink,underline,overline,line-through6.
text-transform : capitalize(upper case/lower case(everything
convert))7.text-indent : : px (distance from line to first letter)
The text-align property is used to set the horizontal alignment of
a text. Text can be centered, or aligned to the left or right, or
justified. When text-align is set to "justify", each line is
stretched so that every line has equal width, and the left and
right margins are straight (like in magazines and newspapers). The
text-decoration property is used to set or remove decorations from
text. The text-decoration property is mostly used to remove
underlines from links for design purposes: The text-transform
property is used to specify uppercase and lowercase letters in a
text.It can be used to turn everything into uppercase or lowercase
letters, or capitalize the first letter of each word. The
text-indentation property is used to specify the indentation of the
first line of a text.Ex: -text.htmlFirst CSS
Page.x{letter-spacing:1px;word-spacing:3px;line-height:1.1em;text-indent:80px;text-align:justify;text-decoration:none;text-transform:capitalize;}some
large text matter Background property: -CSS background properties
are used to define the background effects of an
element.background-color : color name;CSS background properties are
used to define the background effects of an
element.background-image : url(image path name);The
background-image property specifies an image to use as the
background of an element.By default, the image is repeated so it
covers the entire element.The background image for a page can be
set like this:background-repeat :
no-repeat,reapt-x,reapt-y,repeat(*);By default, the
background-image property repeats an image both horizontally and
vertically.Some images should be repeated only horizontally or
vertically, or they will look strange, like this:
background-attachment : fixed,scroll;background-position
:{x,y}left,center,right,bottom,topWhen using a background image,
use an image that does not disturb the text.Showing the image only
once is specified by the background-repeat property://background :
order wiseEx: -First CSS
Page/*body{background-color:silver;background-image:url(2.png);background-repeat:no-repeat;background-attachment:fixed;background-position:280px
80px;}*/body{background:gold url(2.png) no-repeat fixed right
bottom;} some large text matter some large text matter. some large
text matter. some large text matter. some large text matter.List
properties: -list-style-type :
none,disk,circle,square,decimal,upper-alpha,lower-alpha,upper-roman,lower-roman;list-style-position
: outside (*) / inside;list-style-image:url(image path name);Ex: -
listproperties.htmlFirst CSS
Pageul.x{background:#ccc;list-style-type:none;list-style-position:outside;list-style-image:url(tick.png);}ul.x
li{background:gold;padding:5px;margin:2px;}ul.x
li.c{list-style-image:url(cross.png);}We Train PHPWe
Train CMS that is Joomla,DrupalWe Train SAPWe don't Train .NETWe
don't Train Ruby on RailsBox properties: - Padding : inside
elementMargin auto = centerOverflow = visible (*), hidden, auto,
scrollEx: -BOX
properties//body{margin:0px;}p{text-align:center;}.z{background:#ccc;padding:15px;width:50%;height:80px;margin:auto;overflow:auto;text-align:justify;}Terms
& ConditionsSome large text matterBorder: -border-width :
px;border-style :
solid,groove,inset,outset,double,dotted,dashed;border-color :
//border: order wiseEx: - border.htmlBOX
properties.a{border-width:5px;border-style:solid;border-color:gold;}.b{border:10px
dashed red;padding:10px;}.c{border-bottom:5px double
black;padding:10px;}This is a place for social network where people
would have the choices to vote there viewsThis is a place for
social network where people would have the choices to vote there
viewsThis is a place for social network where people would have
the choices to vote there viewsDiv tag: - div tag stand for
division tag div tag is the block level element. A block level
element creates a block with coming left and right breaks in itEx:-
div tag, p tag, h1 to h6, table tag, ul and li tagsIn-line element:
- these particular elements will take the content span only and
does not have breaks init Span tag is the natural tagEx: -in-line
elementh1 {background : green; display : inline;}b{Background:
gold;}a.{text-align : center; background : yellow; display :
block;}hellohellohellohellohellohello converting block &
inline & respectively helloDisplay property: -Visibility : - we
have visible (or) hiddenDisplay: - none, in-line, block;Padding : -
px all sidesPadding: top left 0px 0px Bottom rightMargin: all
sidesMargin : top right bottom left 0px 0px 0px 0pxEx: -display
propertydiv{background:blue;color:#fff;padding:10px;font-size:20pt;margin:2px;}.h{visibility:hidden;}.v{visibility:visible;}//.n{display:none;background:#ddd}//.i{display:inline;}Normal
ElementHidden ElementVisible Element
Display ElementPlease Pay the Bill to avoid late payment
chargesDisplay Inline ElementTemplates: -Position properties: -
position in css we have absolute relative and fixed
positionRelative position: - working from the current position we
can move the element any ware on to the web page but cannot be
moved on the top of the position placeAbsolute & fixed
position: - placing from the current position we can move the
element to all corner of the web page and also one top of the
position place .once an element declare as fixed (or) absolute this
will turn to in-line element and this will also carry 7 index
initEx: - position.htmlPosition
propertiesdiv{background:blue;color:#fff;font-size:17pt;
font-weight:bold;padding:10px;margin:4px;}.r{background:gold;color:#000;position:relative;left:30px;top:120px;}.a{background:blue;position:absolute;top:50px;left:6px;}.f{background:deeppink;color:#000;position:fixed;bottom:0px;right:0px;}Normal
PositionAbsolute PositionRelative PositionFixed Positionsome large
text matter some large text matter some large text matter some
large text matter Hmenu: -Ex: - hmenu.htmlPosition
propertiesul#hmenu{list-style-type:none;text-align:center;margin-top:50px;}ul#hmenu
li{display:inline;margin:0px -2px;}ul#hmenu li
a{text-decoration:none;font-size:17pt;padding:10px
20px;font-weight:bold;}ul#hmenu li a:link,ul#hmenu li
a:visited,ul#hmenu li a:active{background:#000;color:#fff;}ul#hmenu
li
a:hover{background:#ddd;color:#000;}HomeAbout-UsProductsContact
UsLoginVmenu: -Ex: - vmenu.htmlPosition
propertiesul#vmenu{list-style-type:none;padding:0px;background:gold;width:120px;margin:0px;}ul#vmenu
li
a{text-decoration:none;}HomeAbout-UsProductsContact
UsLoginAbout: -Ex:- aboutus.htmlWeb
Layoutbody{margin:0px;}div{background:brown;color:#fff;}.h{text-align:center;}.l{background:green;width:150px;float:left;}.r{background:green;width:150px;float:right;}.m{background:#fff;color:#000;margin:0px
150px;padding:20px;text-align:justify;}div.m
img#img1{float:right;}div.m
img#img2{float:right;padding:10px;clear:both;}HeadingHomeAbout-UsProductsContact
UsLoginRight ContentWe Are in About us PageLayout: -Ex: -Web
Layoutbody{margin:0px;}div{background:brown;color:#fff;}.h{text-align:center;}.l{background:green;width:150px;float:left;}.r{background:green;width:150px;float:right;}.m{background:#fff;color:#000;margin:0px
150px;padding:20px;text-align:justify;}div.m
img#img1{float:right;}div.m
img#img2{float:right;padding:10px;clear:both;}HeadingHomeAbout-UsProductsContact
UsLoginRight Contentsome large text matter write here JavaScript
JavaScript is client side scripting language. JavaScript is the
case sensitive. JavaScript can be used for AJAX integration and
validation. JavaScript can be embed into the head tag and body tag
using script tag JavaScript can be saved with .js as its
extension.Content: Variables Datatypes Operators (Assignment,
Arthamatic, Post/Pre [Inc/Dec], Comparission, Relational,
Conditional, Logical,Ternary) Alert,prompt,confirm Built in
Functions (Arrays,Date,Math,String) DOM (Document Object Module)
Navigator,images,screen,location,history Document (getElementById,
getElementsByTagName, getElementsByName) Events : General Events
(onclick(), ondblclick(), onload(), onunload(), onreset(),
onsubmit(), onfocus(), onblur(), onchange()) Mouse Events
(onmouseover(), onmousemove(), onmousedown(), onmouseout() ) Key
Board Events (onkeyup() , onkeydown() )Document. write (): -
document.write is the printing method in javascript.which will
output statement to the browserEx: -first.htmldocument.write('This
is Called from Head Tag
');Welcomedocument.write('This is Called from Body Tag
');ext.js:-document.write('This is called from External
Page');Variables: - variable are case sensitive. Declaring a
variable in JavaScript we have used with var variable name =
value;Variables are "containers" for storing information.Ex: - var
a = 10; var = defaultThe correct method to declare areVar a =
10;Var_a = 10;Var first-name = suresh;Var firstName = suresh;Var
$name = suresh;Wrong method:-Var #name = suresh;Var 1a = 10; Var
first name = suresh;Ex: -variables.htmldocument.write('This is
Called from Head Tag
'); firstName = 10;document.write('The Value of a is
:'+firstName+'');WelcomeData types: -String: - collection of
characters inside a single (or) double cotation are known as string
working with single cotation and adding double cotation in it is
valid.but adding single cotation inside a single cotation is not
validEx: -datatypes.htmlvar a =
10;document.write(''+a);document.write(' -
');document.write(typeof(a));document.write('
');var f = 10.25;document.write(f);document.write(' -
');document.write(typeof(f));document.write('
');firstname = 'Rajesh';document.write(firstname+' -
'+typeof(firstname)+'
');firstname = firstname+' Kumar';document.write(firstname+' -
'+typeof(firstname)+'
');firstname += 'B';document.write(firstname+' -
'+typeof(firstname)+'
');document.write('String Methods');document.write('i\'ll Pay the
Bill Tomorrow');WelcomeOperators:-Assignment operator: - = is used
to assign values.The assignment operator = is used to assign values
to JavaScript variables.Assignment operators are used to assign
values to JavaScript variables.Ex:-document.write('Assignment
Operator');var x = 10;document.write("The Value is :
"+x);Arithmetic operator: - The arithmetic operator + is used to
add values together.Arithmetic operators are used to perform
arithmetic between variables and/or values.Ex:
-document.write('Arthamatic Operator');a = 5; b =
3;document.write("Addition : "+(a+b)+'
');document.write("Multiplication : "+(a*b)+'
');document.write("Division : "+(a/b)+'
');document.write("Minus : "+(a-b)+'
');document.write("Modulus : "+(a%b)+'
');Comparison operator: - Comparison operators are used in logical
statements to determine equality or difference between variables or
values. Ex: -ocument.write('comparision Operator');if(10 !=
'10'){document.write('Correct');}else {document.write('Not
Correct');}document.write('Post & Pre Increment');m = 10;n =
(m++)+(++m)+(m++)+(++m);document.write('The Value of m is :
'+m+'
The Value of n is : '+n+'
');Relational operator: - < , > , =Logical operator: -
&&(and) -- ||(or)Ternary operator: - Syntax: - Var a=
10;Type = (a%2 == 0)? even number: odd number;//document.write(the
value you entered is : +type);document.write(type);Ex: -
ternary.htmlvar x = 11;type = (x%2==0)?'Even Number':'Odd
Number';document.write("The Value you have Entered is :
"+type+'');student = 'kalpana';perc = 35;gender = 'f';status =
(perc>55)?'Pass':'Fail';document.write(student+' you have
'+status+'ed the Exam. '+((gender == 'm')?'He':'She')+' Has got
'+perc+'% in the Exam');Ex of pay bill:
-.x{background:#ddd;color:deeppink;font-weight:bold;font-family:arial
black;letter-spacing:5px;margin:auto;width:60%;padding:10px;text-align:justify;}credit
= 101;curr_date = 15;pay_date = 13;if(credit > 100 &&
((curr_date-pay_date0))){document.write("Please Pay the Bill to
avoide Late Payment Charges");}some large text write here
Conditions: -If else: - whenever a condition is if it is true that
part of the constructor will be excuted.if condition is fail else
part would get executed Conditional statements are used to perform
different actions based on different conditions use this statement
to execute some code if the condition is true and another code if
the condition is falseSyntax: - If (cond) { //code } else { // code
};If else if: - if else if (or) ladder condition will take more
than one condition (or) multiple conditions. If all the conditions
fail in if else if constructor then only else part get executed use
this statement to select one of many blocks of code to be
executedSyntax: - If(cond) { //code } else if (cond) { //code }
else if (cond) { //code } . . . else { //default value; }Switch: -
use the case in-order wise. this is main concept in switch case use
this statement to select one of many blocks of code to be executed
Conditional statements are used to perform different actions based
on different conditions. Use the switch statement to select one of
many blocks of code to be executed.Syntax: - switch(n) { case 1
execute code block 1 break; case 2: execute code block 2 break;
default: code to be executed if n is different from case 1 and 2 }
Ex: -type = 'ddlj';switch (type){case 'Ravan':document.write('This
is a good Movie ... Review Rating is : 5 star
');break;case 'Titanic':document.write('This is a Holly wood Movie
... Review Rating is : 5 star
');break;case 'don':document.write('This is a good Movie ... Review
Rating is : 4 star
');break;case 'rambo':document.write('This is a good Movie ...
Review Rating is : 3 star
');break;case 100:document.write('This is a 100 good Movie ...
Review Rating is : 3 star
');break;case 1:document.write('This is a 3 good Movie ... Review
Rating is : 3 star
');break;case 2:document.write('This is a 2 good Movie ... Review
Rating is : 3 star
');break;default:document.write('Movie information is not
Available
');break;}Looping methods: - While: do-while: Syntax: Syntax:
Initialize method Initialize While (cond) do { { //code //code }
}While: - Working with while loops it will first check the
initialize part and checks the condition. If condition is true it
will get into the constructor and takes place until condition fail
and comes out of the constructor. loops through a block of code
while a specified condition is trueDo-while: -this will also checks
the initialize part .but for only first time it will get into the
constructor and execute the code and checks the conditions later
and if condition is true looping takes place (or) else it come out
of the constructor with at least single time execution
codeFor-loop: - for loop first initialize condition an inc/dec will
be done on same (single) line for the every first time it will
initialize with part them check within condition if condition is
true the constructor will get excuted.condition fail will come out
of the for loop (constructor) Loops execute a block of code a
specified number of times, or while a specified condition is
true.Syntax: - For (initialize; condition; inc/dec ) { //code }Ex:
-document.write("Day - ");document.write("Day");day =
1;while(day=1920;year--){document.write(""+year+"");}document.write("");Array:
- a variable which can hold more than one value is none as array
(or) super variable as array can be defined is JavaScript as Var a
= new Array (values); // a->super variable To fined the length
of the array we can go with length = array name.length; If the
array index is been initialize more than the current index++ then
memory is vested in JavaScript In arrays initializing string index
the printing method will not work in JavaScriptEx: -
document.write() (or) looping method will not able to print string
indexes While, do-while , for-loop will not print string indexes in
JavaScript so to print string indexes we can go withSyntax: - for
(var name in Array name) For it is key word in JavaScript which
will print the string index The Array object is used to store
multiple values in a single variable. An array is a special
variable, which can hold more than one value, at a time.Create an
ArrayAn array can be defined in three ways. The following code
creates an Array object called myCars:1: var myCars=new Array(); //
regular array (add an optional integermyCars[0]="Saab"; //argument
to control array's size)myCars[1]="Volvo";myCars[2]="BMW";2: var
myCars=new Array("Saab","Volvo","BMW"); // condensed array3: var
myCars=["Saab","Volvo","BMW"]; // literal arrayEx: - Array.htmlvar
a = new Array(10,20,30,40);document.write('The Array is :
'+a+'
');document.write('Length of Array : '+a.length+'
');document.write('Index at 2 : '+a[2]+'
');a[2] = a[2]*2;document.write('The Array is : '+a+'
');a[4] = 'New Value';document.write('The Array is : '+a+'
');var b = new Array();b[0] = 100;b[1] = 200;b[2] = 300;b[3] =
400;b['Name'] = 'Rajesh';b['Age'] = 30;b[7] = 700;b[10] =
1000;document.write('Single string Index :
'+b['Name']+'');document.write('The Array is : '+b+'
');for(i=0;i Get Element ByIdDOCUMENTS----------->
GetElementByTagNameNAVIGATOR------------ >
GetElementByNameEMBEDEx: -dom.htmlfunction
dochange(){document.testForm.fname.value = alert("Please
Enter");document.testForm.fname.value = 'Enter
Name';document.testForm.lname.style.border="2px solid
red";document.testForm.lname.style.width="200px";}First Name
:
Last Name :
Get Element ById:- this particular function will match the id of
the element and that particular matching function will get
executedEx: - getElementById.htmlfunction dochange(){var x =
document.getElementById('test').value;document.getElementById('test').value
= x.toUpperCase();document.getElementById('test').style.color =
'red';}First Name :
First Name : GetElementByTagName:- this particular function will
match tag name and excute the function which we are passing as a
tag nameEx: - getElementsByTagName.htmlfunction dochange(){var a =
document.getElementsByTagName('div');for(i=0;i10){m =
s.substr(0,10);document.testForm.Msg.value = m;c =
0;}document.testForm.count.value = c;}Gallery create: -Ex: -
gallery.htmlGallery Thumb ViewGallery.css:
-body{background:lightblue;margin:0px;}.header{background:darkblue;height:80px;color:#fff;text-align:center;font-size:18pt;font-family:courier
new;letter-spacing:5px;font-weight:bold;line-height:70px;}.thumb{text-align:center;margin:20px
0px 10px 0px;}.thumb
img{width:120px;height:100px;cursor:pointer;}.big{text-align:center;}.big
img{width:400px;height:300px;}.butob{margin-bottom:10px;}.buto{font-size:18pt;padding:8px
20px;background:#000;color:#fff;}.buto:hover{background:#ddd;color:#000;cursor:pointer;}gallery.js:
-function alterImage(id,source){document.getElementById(id).src =
source;}function zoom(id,type){var min_W = 120;var min_H = 100;var
max_W = 1000;var max_H = 900;var n_W = 400;var n_H = 300;img =
document.getElementById(id);var curr_W = parseInt(img.width);var
curr_H = parseInt(img.height);switch (type){case '+':new_W =
curr_W+(curr_W*.1);new_H = curr_H+(curr_H*.1);break;case '-':new_W
= curr_W-(curr_W*.1);new_H = curr_H-(curr_H*.1);break;case
'0':new_W = n_W;new_H = n_H;break;}if((new_Wmax_H)){}else
{img.style.width = new_W;img.style.height = new_H;}}DHTML:
-innerHTML.htmlfunction
showText(v){document.getElementById('Msg').innerHTML = v;}First
Name : innerHTML2.htmlfunction showText(v){len =
v.length;//alert(len);if(lenplatform(windows,linux,mac,solaries)
a----------------------------->apache(web server)
m---------------------------->mysql(database file)
p---------------------------->perl(perl scripting in php)
p---------------------------->php/my admin (web database tool)
php current version is 5.3.8wamp: - wamp stands for
w---------------------------->window exv
a----------------------------->apache(web server)
m---------------------------->mysql(database file)
p---------------------------->php/my admin (web database
tool)Mamp: - mamp stands for m----------------------------->mac
os a----------------------------->apache(web server)
m---------------------------->mysql(database file)
p---------------------------->php/my admin (web database
tool)Apache contain the 1-65535 ports 1-1024 pre-reserved portsTem:
- temp holds session details & temp upload filesHtdocs: - after
installing xampp we have to store our files into the folder called
htdocs. Once files are saved in htdocs we can open with the
location path as http://localhost/abc(folder name)/first.php
echo:-echo is the output method in phpBasic PHP Syntax: -echo
javascript way of writtting php
; Comments in PHPIn PHP, we use // to make a one-line comment or /*
and */ to make a comment block: Printing methods in php:
-Echo:-echo as the arguments can print multiple arguments. Echo as
a function can print only one argumentPrint: -print as an argument
can print only one argument.print also a functionEx: -
printarg
;Printf: - printf will take formatting string with respected values
as printEx: -printf((int%d) (float%f) (string %s)
(asci%c));Print-r: - print-r will print array of stringEx: - $g =
array (10,20,30,true,kalam);Print-r($g);Var-dump: -it is also
printing method which is used debugging the errors very easily.
This not used in production level (live environmental)Ex: -
var-dump($g);Printing Methods in PHPControlling: -Ex: -
controlling.phpb{color:green;}This is Bold TagAlternate
MethodThe 1st is Executed
The 2nd is
Executed
Variables: - Variables are "containers" for
storing information. Variables in PHP starts with a $ sign,
followed by the name of the variable The variable name must begin
with a letter or the underscore character A variable name can only
contain alpha-numeric characters and underscores (A-z, 0-9, and _)
A variable name should not contain spaces Variable names are case
sensitive (y and Y are two different variables)Ex: -
variables.phpVariables in phpvar a = 15;document.write('The Value
of a is : '+a+'
'); In PHP, a variable does not need to be declared before adding a
value to it. In the example above, notice that we did not have to
tell PHP which data type the variable is. PHP automatically
converts the variable to the correct data type, depending on its
value. In a strongly typed programming language, you have to
declare (define) the type and name of the variable before using
it.PHP has four different variable local global staticLocal
variable: - A variable declared within a PHP function is local and
can only be accessed within that function.Ex:-
localvariable.phpStatic variable: - When a function is completed,
all of its variables are normally deleted. However, sometimes you
want a local variable to not be deleted.To do this, use the static
keyword when you first declare the variable.Ex: -
staticvariable.phpGlobal variable: - Global scope refers to any
variable that is defined outside of any function.Global variables
can be accessed from any part of the script that is not inside a
function.To access a global variable from within a function, use
the global keyword:Ex: - global.php4. Super global array of
variable: -$global is the super global array variable. This is the
pre-defined keyword. In php we have mainly some of the super global
variables. This can be used with their keywords.i) $_EVN: - this is
used for getting the information of your operating system ($_ENV
(PATH))ii) $_SERVER: - will give you the information about your
server(apache information)iii) $_GET: - it is used for form
processing through get method (or) query stringiv) $_POST: -this is
used for form processing through post method in secure mannerv)
$_REQUEST: -will send the form through both get and post and
cookievi)$_COOKIE: - this is used to get the information about the
browser who is using the web(computer)vii)$_SESSION: -it is used to
get the information of the user in between login and logout details
are store at server machineOperators:-1. Assignment operator: = is
used to assign values to variables in PHP2. Arithmetic operator:
+,-,/,*,%3. Increment & decrement operator: i++,++I & i--,
--i4. Comparison operator: ==,!= ,=== 5. Relational operator: =, 6.
Logical operator: &&, ||, and, or7. Error handling
operator: -8. scope resolution & this operator:
::----->scope, &------->thisEx: -operator.phpType
costing: - conversion of the one data type into another data type
is known as type costing. in php we have mainly two types of
costing1. Temporary type costing2. Permanent type costing1.
Temporary type costing: - costing which can be done for single step
by pre-defined the data type keyword. That particular variable will
hold Temporary type costingEx : - temporary.php2. Permanent type
costing: - this can be done by using pre-defined key-word set
type.which hold two arguments Syntax: - set type (var name,int);Ex:
- Permanent type costing.phpType juggling: -conversion of data
types by using expression to another data types are known as type
jugglingEx: -typejuggling.phpVariable validation function: -i)
Isset: -Isset of variables will check with the variable initialize
are not and return Booleanii) empty(var name): - empty function
will check the variable are not and return Booleaniii) Unset (var
name): -this function will remove the variable (or) delete the
variable (or) initialize variableiv) get type(var name): - this
function will let us known the argument the data type in the form
of string .this should be used because the coming variable this
would be depreciatedEx: -variable_validation.phpData types: -php
supports mainly 8 kinds of data types among which four are stable
data types, two are compound data types and another two are special
data typesStable data types: -i) int (or) integerii) Float (or)
real (or) decimaliii) Boolean data typesiv) string data typesi) int
(or) integer:- all non decimal values . range in between 2(32-1) to
-2(32-1)ex: -ii) Float (or) real (or) decimal: -all decimal values.
Range in between 10(38) to 10(-38)ex: -iii) Boolean data types:
-boolean data types written in the form of true (or) falseEx: -iv)
String data types: - a collection of characters enclose in between
single (or) double cotations are known as string data typesEx:
-Compound data types: - compound data types again two types 1.
Array data type2. Object data type1. Array data type: - array data
type which can hold more than one value. In php we have mainly 3
kinds of arraysi) Numerical arrayii) Associative arrayiii) Mixed
array Declaring an array in php can be done by two types array as
the function array as a square bracketi) Numerical array: -A
numeric array stores each array element with a numeric index.There
are two methods to create a numeric array.1. In the following
example the index are automatically assigned (the index starts at
0):$cars=array("Saab","Volvo","BMW","Toyota"); 2. In the following
example we assign the index
manually:$cars[0]="Saab";$cars[1]="Volvo";$cars[2]="BMW";$cars[3]="Toyota";
Ex: - ii) Associative array: - An associative array, each ID key is
associated with a value.When storing data about specific named
values, a numerical array is not always the best way to do it.With
associative arrays we can use the values as keys and assign values
to them.Example 1In this example we use an array to assign ages to
the different persons:$ages = array("Peter"=>32,
"Quagmire"=>30, "Joe"=>34); Example 2This example is the same
as example 1, but shows a different way of creating the
array:$ages['Peter'] = "32";$ages['Quagmire'] = "30";$ages['Joe'] =
"34"; The ID keys can be used in a script: The code above will
output:Peter is 32 years old. iii) Mixed array: - mixed array is
nothing but combination of numerical & associative array are
known as mixed arrayEx:- mixedarrays.php2. Object data type: -
object is an instance of class. Class can be denoted with in class
name. Collection of variables and functions are known as class.
Calling class name should be create an object variable then that
particular variable is known as object variableEx: -Special data
types: - special data types are again two types i) Resource data
typesii) Null data typesi) Resource data types:- resource data type
is calling an external variable value into another variable using
(&) resource variableii) Null data types:- this is the
pre-defined key-word data type. When a variable not initialize and
by asking through printing method. This will result in null value
ex: -Constant: Define: - define is the pre-defined key-word in php.
This will take two arguments. The first argument being the constant
identifier which identifier its second argument value. We can pass
third argument as Boolean to make case in-sensitiveEx:-
constant.phpAbout uswe at are in training ........Contact Us street
......FAQwhat we do at Conditions: - Conditional statements are
used to perform different actions based on different conditionsIf
condition: IN PHP IN PERL If (cond) if (cond) : { //code //code
else if (code) : } //code else if (cond) else (cond) : { //code
//code end else if ; } else (cond) { //code }Switch condition:
-Syntax: - switch (cond) : switch (cond): { | Case1 : | //code |
Break; | Case2: //code | Break; end switch; | | Default: //code
}Ex: - While condition: - The while loop executes a block of code
while a condition is true Syntax: - While (cond) while (cond): {
//code inc/dec //const code inc/dec endwhile }Ex: - Output:The
number is 1The number is 2The number is 3The number is 4The number
is 5Do-while condition: - The do...while statement will always
execute the block of code once, it will then check the condition,
and repeat the loop while the condition is true.Syntax: - Do do: {
//code inc/dee //code endoowhile(cond); } While (cond)ExampleThe
example below defines a loop that starts with i=1. It will then
increment i with 1, and write some output. Then the condition is
checked, and the loop will continue to run as long as i is less
than, or equal to 5: Output:The number is 2The number is 3The
number is 4The number is 5The number is 6 For loop: - Loops execute
a block of code a specified number of times, or while a specified
condition is true. The for loop is used when you know in advance
how many times the script should run. Syntax: -
For(initialize;cond;inc/dec) for(initialize;code;inc/dec //code
//code end forExampleThe example below defines a loop that starts
with i=1. The loop will continue to run as long as i is less than,
or equal to 5. i will increase by 1 each time the loop runs:
Output:The number is 1The number is 2The number is 3The number is
4The number is 5Ex: -conditions.phpfor each:- for each is usefull
for all non-sequence data of an array. Associative array ,numerical
array object data of an arrayThe general syntax is foreach
(arrayName as arr[value])) { echo arr [value]; }Another syntax is
foreach (arrayname as key=>value){echo key-value (or) echo
key-value;}Ex: -foreach.phpFunctions: -functions are case
in-sensitive. Function once can be declare cont be re-declare in
the programThe real power of PHP comes from its functions.In PHP,
there are more than 700 built-in functionsTo keep the script from
being executed when the page loads, you can put it into a
function.A function will be executed by a call to the function.You
may call a function from anywhere within a page. Give the function
a name that reflects what the function does The function name can
start with a letter or underscore (not a number)Syntax: - function
function name (arg) { //code Return value }There are mainly 8 kinds
of functions in php1. Conditional function: - a function which is
enclose inside condition is considered as conditional functionEx: -
conditional.php successful5xx->server issue4xx->page
issue3xx->redirectiond) Response Text: - The information send
from the server as text content.ajax.responseTexte) ResponseXML:-
used for accessing response XMLajax.responseXMLFlow of AJAX based
Application:-1. User action is performed on any of the HTML
components Like button, hyperlink, selectbox, textbox etc.2.
Certain JavaScript event is raised because of the above User
action3. Specific user defined JavaScript function is called to
handle The above raised JavaScript event.4. In the above JavaScript
functiona. Logic is written to create Ajax engineb. Partial form
data is gatheredc. Callback (user-defined) function is set to
onreadystatechange Property of AJAX engine.d. URL is prepared along
with every stringe. Connection is established (open method is
called)f. Request is sent to server (send () is called)5. Request
related response comes to AJAX engine as text or XML data.6. Once
again callback function is called. Inside callback function a.
Logic to take response received by AJAX engine using JavaScriptb.
Logic is written to update certain portions of the
currentwebpagesWithout reloading the entire webpage with the
receiver response. JOOMLA JOOMLA is a content management system. It
is a CMS tool. It is developed on php using mysql as its backend.
JOOMLA is a object oriented based tool which was developed on
theTop of MVC architecture. JOOMLA comes with various Predefined
templates, components, modules, languages And plug-ins. JOOMLA
software is available in various
versions.(JOOMLA1.0.x,JOOMLA1.5.x,JOOMLA1.6.x)JOOMLA software
consists of two interfaces.1. User interface (front end)2. Admin
interface (Backend)1. User Interface: - Front end is the actual
website Which is shown to the actual users of the website.2. Admin
interface: - Backend is the interface Which is accessible for the
backend users forManaging the website with various actions.User
Management: - It allows the management of the Users to the website.
Various types of users are observedFront end
users:-registeredSpecial:-editor, publisherBackend users:-Manager,
Adminstrator, Super administratorMedia Management:-It is used for
managing media files in the software.Section
management:-Section:-It is a top level hierarchy for content
Classification. It allows the management of sections.Category
management:-A category is the child category For a section used for
sub classifying the content.Article Management:-It can be
considered as a webpage In the site which can be classified to a
category Or a sectionComponent: - A component is a functional block
in the Website which can be considered as Database Interaction and
can be loaded at the main (center) Portion of the website.Module:-
It is a functional block which can occupy Various predefined
positions in the software like top,left,right,user1,user2,...usern,
footer etc. A module can be controlled for its display in One or
more pages.Plug-in:-A plug-in is a logical part which will Enhance
the way in which we will display the Content of the
website.Template management:- A template is a predefined Interface
which is used for switching the user Interfaces on the fly.Language
management: - JOOMLA supports multilingual Sites where we can
install language extension for Adding support with additional
language.www.joomla.orgLatest version is 1.7Installation of
JOOMLA:-1. Install joomla without sample data2. Add all the users
for each role3. Create few categories4. Create few articles.5. Add
the menu links for the articles category6. Download free JOOMLA
templates and install.Switch between the templates7. Try to change
logo of the template8. Install the external modules plug-ins9.
Activate free loaded modules and plug-ins.Check their
functionality10. create a website with few links using JOOMLA
JQUERY JQuery is a JavaScript framework which is used For writing
less code and doing more action JQuery is developed on top of java
platform and it is used for creating rich website interface. JQuery
is a fast and concise JavaScript library. That simplifies HTML
document traversing, event Handling, animating and Ajax interaction
for Rapid web development. JQuery is designed to Change the way
that you write
JavaScript.www.jquery.comSyntax:-$(selector).methodSpecial
effects:-Hide ()Show ()JQueryJQuery documentsJQuery core
selectorJQuery supports css page
selectorTraversingCSSEffectsEventsAJAX: implements JQuery
plug-insUse JQuery pop calendarWrite JQuery cursorsJQuery based
tool tipsJQuery based light boxJQuery based form validationsJQuery
based news agrigation using AJAX --------------------------THE
END------------------------ Javascrtipt_Interview_Quesions
PHP_Interview_questions Javascrtipt_Interview_Quesions1) x=4+"4";
document.write(x); Output------?a) 44 b) 8 c) 4 d) Error output
Ans: a2) var qpt = "Vempower Solutions";var result = qpt.split("
");document.write(result); a) Vempowerb) V,e,m,p,o,w,e,r,
S,o,l,u,t,I,o,n,sc) Vempower Solutionsd) VempoweSolutionsAns: c3)
Is it possible to nest functions in JavaScript? a) True b)
FalseAns: a4) document.write(navigator.appCodeName); a) get code
name of the browser of a visitor b) set code name of the browser of
a visitor c) None of the above Ans: a5) Which of the following is
true? a) If onKeyDown returns false, the key-press event is
cancelled. b) If onKeyPress returns false, the key-down event is
cancelled. c) If onKeyDown returns false, the key-up event is
cancelled. d) If onKeyPress returns false, the key-up event is
canceled. Ans: a6) Scripting language are a) High Level Programming
language b) Assembly Level programming language c) Machine level
programming language Ans: a7) function x(){var s= "Good 100%"; var
pattern = /\D/g;var output=
s.match(pattern);document.write(output);} a) Good % b) 1,0,0 c)
G,o,o,d,% d) Error Ans: c8) var qpt="Sample String ";
alert(qpt.charAt(qpt.length-1)); a) p b) e c) g d) ErrorAns: c9)
Are java and javascript the same?a) NO b) YES Ans: a10) Syntax for
creating a RegExp object:(a). var txt=new
RegExp(pattern,attributes);(b). var txt=/pattern/attributes;Which
of the above mentioned syntax will correct?a) (a) only b) (b) only
c) Both (a) and (b) d) None of the above Ans: c11) function
x(z,t){alert(x.length);}output:?a) Error b) 2 c) 1 d) 3 Ans: b12)
What is mean by "this" keyword in javascript?a) It refers current
object b) It referes previous object c) It is variable which
contains value d) None of the above Ans: a13) In JavaScript,
Window.prompt() method return true or false value ? a) False b)
True c) None of above Ans: a14) Math. round(-20.51)=? a) 20 b) -21
c) 19 d) None Ans: b15) function x(){var s = "Quality
100%!{[!!";var pattern = /\w/g;var output =
s.match(pattern);document.write(output);} a) %,!,{,[,!,! b)
Q,u,a,l,i,t,y,1,0,0 c) Quality 100 d) Error Ans: b16) var qpt= new
Array();qpt[0] =
"WebDevelopment";qpt[1]="ApplicationDevelopment"qpt[2]="Testing"qpt[3]
= "Vempower Solutions";document.write(qpt[0,1,2,3]);a) Error b)
Vempower Solutionc) WebDevelopment d)
WebDevelopmnet,ApplicationDevelopment,Testing,Vempower Solutions
Ans: b17) parseFloat(9+10)=? a) 19 b) 910 c) None Ans: c18)
function x(){document.write(2+5+"8");} a) 258 b) Error c) 7 d) 78
Ans: d19) In Javascript, Which of the following method is used to
evaluate the regular expression?a) eval(2*(3+5)) b)
evaluate(2*(3+5)) c) evalu(2*(3+5)) d) None of the aboveAns: a20)
function x(){var s= "quality 100%"; var pattern = /\d/g;var output=
s.match(pattern);document.write(output);} a) 100 b) 1,0,0 c)
q,u,a,l,i,t,y,% d) Error Ans: b21) qpt=((45%2)==0)? "hello" :
"bye";document.write(qpt); a) hello b) bye c) Error in string
handling d) None of the aboveAns: b22) How do you create a new
object in JavaScript?a) var obj = {}; b) var obj = Object(); c) var
obj=new {}; d) None of the above Ans: a23) In Javascript, What does
isNaN function do ?a) Return true if the argument is not a number.
b) Return false if the argument is not a number. c) Return true if
the argument is a number. d) None of the above Ans: a24) Which of
the following properties hold the values of the pixels of the
length of the width and height of the viewer's screen resolution?a)
screen.width and screen.height b) Resolution.width and
Resolution.height c) screen.pixels.width and screen.pixels.height
d) ViewerScreen.width and ViewerScreen.height Ans: a25)How to
assign a function to a variable with the JavaScript Function
contructor ? a) var f=Function("x","y","return x+y"); b) var
f=Function(x,y){ return x+y;} c) var f= new Function("x", "y",
"return x + y"); Ans: b26) In JavaScript, Window.alert() is used to
allow user to enter somethinga) True b) False c) None of above Ans:
b27) Is Javascript has any date data type?a) Yes b) No Ans: b28)
?_name is it valid javascript identifier? a) Yes b) No Ans: a29)
var qpt="V-Empower Solutions ";var result
=qpt.lastIndexOf("s");document.write(result); a) -1 b) 18 c) 17 d)
19 Ans: 1830) function sum(x){function add(y){return x+y;}return
add;}function callme() { result=sum(5)(5); alert(result); }If you
call the function callme(), what will happen ?a) 10 b) Error in
calling Function c) 5 d) None of the above Ans: a31)
document.write("This is a heading");document.write("This is a
paragraph.");document.write("This is another paragraph.");Can you
write HTML tag inside the javascript ? a) No b) Yes c) Impossible
Ans: b32) How to speicfy the color of the hypertext links with
JavaScript ?a) document.linkColor="#00FF00"; b)
document.LColor="#00FF00"; c) document.LinkC="#00FF00"; d)
document.hyperTextLink="#00FF00": Ans: a33) ------------- converts
a string to floating point numbers. a) eval b) ParseInt c)
ParseFloat d) None Ans: c34) In Javascript, Which of the following
method is used to find out the character at a position in a string?
a) charAt() b) CharacterAt() c) CharPos() d) characAt() Ans: a35)
var qpt = "V-Empower Solutions";var result
=qpt.substring(7,8);document.write(result);36) What are the
following looping structures are available in javascripts?a)
for,forecach b) foreach,whileloop c) do-while loop,foreach d) for ,
while loop Ans: d37) Which of these is not a method of the Math
object?a) atan() b) atan2() c) eval() d) acos() Ans: c38) var s =
"9123456 or 80000?";var pattern = /\d{4}/;var output =
s.match(pattern);document.write(output);a) 9123 b) 91234 c) 80000
d) None of the above Ans: a39) In javascript, RegExp Object Method
test() is used to search a string and returns a) true or false b)
found value c) index d) None of the above Ans: a40) What property
would you use to redirect a visitor to another page? a)
document.URL b) window.location.href c) .document.location.href d)
link.href Ans: c41) -------------- method is used to remove focus
from the specified object. a) blur() b) focus() c) None Ans:
a42)Javascript is a ________ typed language. a) tightly b) loosely
Ans: b43)Choose the built-in object: a) Password b) Math c) Link d)
Hidden Ans: b44)Choose the object(s) associated with the onFocus
event handler: a) Password b) Hidden c) Both d) Neither Ans:
a45)Choose the object(s) associated with the onKeyPress event
handler: a) Document b) Layer c) Both d) Neither Ans: a46)Choose
the best pattern for the string: 840-21-3688 a) /\d+-\d{2,}-?\d*/
b) /\w+-\w+-\w+/ c) /\d+\d+\d+/ d) /\d+-\d?-\d+/ Ans: a47) Which
would JavaScript assign to an uninitialized variable? a) NaN b)
null c) undefined d) false Ans: c48)Which is not a built-in
function? a) parseInt() b) exec() c) eval() d) parseFloat() Ans:
b49)Seek the truth about setTimeOut(): a) The statement(s) it
executes run(s) only once. b) It pauses the script in which it is
called. c) clearTimeOut() won't stop its execution. d) The delay is
measured in hundredths of a second. Ans: a50)How do you call a
function named "myFunction"?a) call function myFunctionb)
myFunction()c) call myFunction()Ans: c51) What is the correct
JavaScript syntax for opening a new window called "window2"
?a)new("http://www.w3schools.com","window2")b)new.window("http://www.w3schools.com","window2")c)window.open("http://www.w3schools.com","window2")d)open.new("http://www.w3schools.com","window2")Ans:
c52)How do you find the client's browser
name?a)client.navNameb)browser.namec)navigator.appNameAns: c53)
Semicolons are optional at the end of a JavaScript statement.
a)True b)FalseAns: a54)Which of the following are capabilities of
functions in JavaScript? a) Return a value b) Accept parameters and
Return a value c) Accept parameters d) None of the above Ans:
c55)Which popup box you use when want a value from user before open
a page?a) alert("Write some text here")b) confirm("Write some text
here")c) prompt("Write here some text")d) None of the aboveAns:
c56)What is the correct way to write a JavaScript array?a) var txt
= new Array("tim","kim","jim")b) var txt = new
Array="tim","kim","jim"c) var txt = new
Array:1=("tim")2=("kim")3=("jim")d) var txt = new
Array(1:"tim",2:"kim",3:"jim")Ans: a57) How to submit form data
with javascript?a) document.formname.submit();b) submit()c)
document.submit()d)None of the aboveAns: a58) When a user views a
page containing a JavaScript program, which machine actually
executes the script? a) The User's machine running a Web browser b)
The Web server c) A central machine deep within Netscape's
corporate offices d) None of the aboveAns: a59) Which of the
following is not a valid JavaScript variable name? a) 2names b)
_first_and_last_names c) FirstAndLast d) None of the aboveAns:a 60)
To set up the window to capture all Click events, we use which of
the following statement? a) window.captureEvents(Event.CLICK);b)
window.handleEvents (Event.CLICK);c) window.routeEvents(Event.CLICK
);d) window.raiseEvents(Event.CLICK ); Ans: a
PHP_Interview_questionsQuestion: 1 Who is the father of PHP?Answer:
Rasmus Lerdorf is known as the father of PHP. Question: 2 What is
the difference between $name and $$name? Answer: $name is variable
where as $$name is reference variable like $name=sonia and
$$name=singh so $sonia value is singh. Question: 3 How can we
submit a form without a submit button? Answer: 3 Java script submit
() function is used for submit form without submit buttonon click
call document.formname.submit() Question : 4 In how many ways we
can retrieve the data in the result set ofMySQL using PHP?Answer :
4 We can do it by 4 Ways1. mysql_fetch_row. 2. mysql_fetch_array3.
mysql_fetch_object4. mysql_fetch_assocQuestion : 5 What is the
difference between mysql_fetch_object andmysql_fetch_array?Answer :
5 mysql_fetch_object() is similar tomysql_fetch_array(), with one
difference -an object is returned, instead of an array. Indirectly,
that means thatyou can only access the data by the field names, and
not by theiroffsets (numbers are illegal property names). Question
: 6 What are the differences between get and post methods. Answer :
6 There are some defference between GET and POST method 1. GET
Method have some limit like only 2Kb data able to send for request
But in POST method unlimited data can we send 2. when we use GET
method requested data show in url but Not in POST method so POST
method is good for send sensetive request Question : 7 How can we
extract string "pcds.co.in " from a string "http://[email protected]
using regular expression of PHP?Answer : 7
preg_match("/^http:\/\/.+@(.+)$/","http://[email protected]",$matches);echo
$matches[1];Question : 8 How can we create a database using PHP and
MySQL?Answer : 8 We can create MySQL database with the use
ofmysql_create_db("Database Name") .Question : 9 What are the
differences between require and include?Answer : 9 Both include and
require used to include a file but when included file not found
Include send Warning where as Require send Fatal Error .Question :
10 Can we use include ("xyz.PHP") two times in a PHP page
"index.PHP"?Answer : 10 Yes we can use include("xyz.php") more than
one time in any page. but it create a prob when xyz.php file
contain some funtions declaration then error will come for already
declared function in this file else not a prob like if you want to
show same content two time in page then must incude it two time not
a prob.Question : 11 What are the different tables(Engine) present
in MySQL, which one is default?Answer : 11 Following tables
(Storage Engine) we can create.1. MyISAM(The default storage engine
IN MYSQL Each MyISAM table is stored on disk in three files. The
files have names that begin with the table name and have an
extension to indicate the file type. An .frm file stores the table
format. The data file has an .MYD (MYData) extension. The index
file has an .MYI (MYIndex) extension. )2. InnoDB(InnoDB is a
transaction-safe (ACID compliant) storage engine for MySQL that has
commit, rollback, and crash-recovery capabilities to protect user
data.)3. Merge4. Heap (MEMORY)(The MEMORY storage engine creates
tables with contents that are stored in memory. Formerly, these
were known as HEAP tables. MEMORY is the preferred term, although
HEAP remains supported for backward compatibility. )5. BDB
(BerkeleyDB)(Sleepycat Software has provided MySQL with the
Berkeley DB transactional storage engine. This storage engine
typically is called BDB for short. BDB tables may have a greater
chance of surviving crashes and are also capable of COMMIT and
ROLLBACK operations on transactions) 6. EXAMPLE 7. FEDERATED (It is
a storage engine that accesses data in tables of remote databases
rather than in local tables. )8. ARCHIVE (The ARCHIVE storage
engine is used for storing large amounts of data without indexes in
a very small footprint. )9. CSV (The CSV storage engine stores data
in text files using comma-separated values format.)10. BLACKHOLE
(The BLACKHOLE storage engine acts as a "black hole" that accepts
data but throws it away and does not store it. Retrievals always
return an empty result). Question : 12 What is use of header()
function in php ?Answer : 12 The header() function sends a raw HTTP
header to a client.We can use herder() function for redirection of
pages. It is important to notice that header() must be called
before any actual output is seen.Question: 13 How can I execute a
PHP script using command line? Answer : 13 Just run the PHP CLI
(Command Line Interface) program andprovide the PHP script file
name as the command line argument. Question : 14 Suppose your Zend
engine supports the mode Then how can u configure your PHP Zend
engine to support mode ?Answer : 14 In php.ini file: set
short_open_tag=on to make PHP support .Question : 15 Shopping cart
online validation i.e. how can we configure Paypal, etc.?Answer :
15 Nothing more we have to do only redirect to the payPal url
aftersubmit all information needed by paypal like amount,adresss
etc.Question : 16 What is meant by nl2br()?Answer : 16 Inserts HTML
line breaks (
) before all newlines in a string.Question : 17 What is htaccess?
Why do we use this and Where?Answer : 17 .htaccess files are
configuration files of Apache Server which providea way to make
configuration changes on a per-directory basis. A file, containing
one or more configuration directives, is placed in a
particulardocument directory, and the directives apply to that
directory, and all subdirectories thereof.Question : 18 How we get
IP address of client, previous reference page etc?Answer : 18 By
using $_SERVER['REMOTE_ADDR'],$_SERVER['HTTP_REFERER'] etc.Question
: 19 What are the reasons for selecting lamp (Linux, apache, MySQL,
PHP) instead of combination of other software programs, servers and
perating systems?Answer : 19 All of those are open source resource.
Security of Linux is veryvery more than windows. Apache is a better
server that IIS both infunctionality and security. MySQL is world
most popular open sourcedatabase. PHP is more faster that asp or
any other scripting language.Question : 20 How can we encrypt and
decrypt a data present in a MySQL table using MySQL?Answer : 20
AES_ENCRYPT () and AES_DECRYPT (). Question : 21 How can we encrypt
the username and password using PHP? Answer : 21 The functions in
this section perform encryption and decryption, andcompression and
uncompression:
encryptiondecryptionAES_ENCRYT()AES_DECRYPT()ENCODE()DECODE()DES_ENCRYPT()DES_DECRYPT()ENCRYPT()Not
availableMD5()Not availableOLD_PASSWORD()Not availablePASSWORD()Not
availableSHA() or SHA1()Not availableNot
availableUNCOMPRESSED_LENGTH()Question : 22 What are the features
and advantages of object-orientedprogramming?Answer : 22 One of the
main advantages of OO programming is its ease ofmodification;
objects can easily be modified and added to a system thereby
reducing maintenance costs. OO programming is also considered to
bebetter at modeling the real world than is procedural programming.
Itallows for more complicated and flexible interactions. OO systems
arealso easier for non-technical personnel to understand and easier
forthem to participate in the maintenance and enhancement of a
systembecause it appeals to natural human cognition patterns.For
some systems, an OO approach can speed development time since
manyobjects are standard across systems and can be reused.
Components thatmanage dates, shipping, shopping carts, etc. can be
purchased and easilymodified for a specific system.Question : 23
What are the differences between procedure-oriented languages and
object-oriented language?Answer : 23 There are lot of difference
between procedure language and object oriented like
below1>Procedure language easy for new developer but complex to
understand whole software as compare to object oriented
model2>In Procedure language it is difficult to use design
pattern mvc , Singleton pattern etc but in OOP you we able to
develop design pattern3>IN OOP language we able to ree use code
like Inheritance ,polymorphism etc but this type of thing not
available in procedure language on that our Fonda use COPY and
PASTE . Question : 24 What is the use of friend function?Answer :
24 Sometimes a function is best shared among a number of
differentclasses. Such functions can be declared either as member
functions ofone class or as global functions. In either case they
can be set to befriends of other classes, by using a friend
specifier in the class thatis admitting them. Such functions can
use all attributes of the classwhich names them as a friend, as if
they were themselves members of thatclass.A friend declaration is
essentially a prototype for a member function,but instead of
requiring an implementation with the name of that classattached by
the double colon syntax, a global function or memberfunction of
another class provides the match. Question : 25 What are the
differences between public, private, protected,static, transient,
final and volatile? Answer : 25 Public: Public declared items can
be accessed everywhere.Protected: Protected limits access to
inherited and parentclasses (and to the class that defines the
item).Private: Private limits visibility only to the class that
definesthe item.Static: A static variable exists only in a local
function scope,but it does not lose its value when program
execution leaves this scope.Final: Final keyword prevents child
classes from overriding amethod by prefixing the definition with
final. If the class itself isbeing defined final then it cannot be
extended.transient: A transient variable is a variable that may
notbe serialized. volatile: a variable that might be concurrently
modified by multiplethreads should be declared volatile. Variables
declared to be volatilewill not be optimized by the compiler
because their value can change atany time.Question : 26 What are
the different types of errors in PHP?Answer : 26 Three are three
types of errors:1. Notices: These are trivial,non-critical errors
that PHP encounters while executing a script forexample, accessing
a variable that has not yet been defined. By default,such errors
are not displayed to the user at all although, as you willsee, you
can change this default behavior.2. Warnings: These are more
serious errors for example, attemptingto include() a file which
does not exist. By default, these errors aredisplayed to the user,
but they do not result in script termination.3. Fatal errors: These
are critical errors for example,instantiating an object of a
non-existent class, or calling anon-existent function. These errors
cause the immediate termination ofthe script, and PHP's default
behavior is to display them to the userwhen they take place.
Question : 27 What is the functionality of the function strstr and
stristr? Answer : 27 strstr Returns part of string from the first
occurrence of needle(sub string that we finding out ) to the end of
string. $email= '[email protected]';$domain = strstr($email,
'@');echo $domain; // prints @gmail.comhere @ is the needle stristr
is case-insensitive means able not able to differentiate between a
and A. Question : 28 What are the differences between PHP 3 and PHP
4 and PHP 5? Answer : 28 There are lot of difference among these
three version of php1.Php3 is oldest version after that php4 came
and current version is php5 (php5.3) where php6 have to come
2.Difference mean oldest version have less functionality as compare
to new one like php5 have all OOPs concept now where as php3 was
pure procedural language constructive like C In PHP5 1.
Implementation of exceptions and exception handling2. Type hinting
which allows you to force the type of a specific argument3.
Overloading of methods through the __call function4. Full
constructors and destructors etc through a __constructor and
__destructor function5. __autoload function for dynamically
including certain include files depending on the class you are
trying to create.6 Finality : can now use the final keyword to
indicate that a method cannot be overridden by a child. You can
also declare an entire class as final which prevents it from having
any children at all.7 Interfaces & Abstract Classes8 Passed by
Reference : 9 An __clone method if you really want to duplicate an
object.Question : 29 How can we convert asp pages to PHP pages?
Answer : 29 there are lots of tools available for asp to PHP
conversion. you cansearch Google for that. the best one is
available athttp://asp2php.naken.cc./. Question : 30 What is the
functionality of the function htmlentities? Answer : 30 Convert all
applicable characters to HTML entitiesThis function is identical to
htmlspecialchars() in all ways, exceptwith htmlentities(), all
characters which have HTML character entityequivalents are
translated into these entities. Question : 31 How can we get second
of the current time using date function?Answer : 31 $second =
date("s");Question : 32 How can we convert the time zones using
PHP? Answer : 32 By using date_default_timezone_get and
date_default_timezone_set function on PHP 5.1.0 Question : 33 What
is meant by urlencode and urldocode?Answer : 33 URLencode returns a
string in which all non-alphanumeric charactersexcept -_. have been
replaced with a percent (%) sign followed by two hex digits and
spaces encoded as plus (+) signs. It is encoded the same way that
the posted data from a WWW form is encoded, that is the same way as
in application/x-www-form-urlencoded media type. urldecode decodes
any %##encoding in the given string.Question : 34 What is the
difference between the functions unlink and unset?Answer : 34
unlink() deletes the given file from the file system.unset() makes
a variable undefined.Question : 35 How can we register the
variables into a session?Answer : 35 $_SESSION['name'] =
"sonia";Question : 36 How can we get the properties (size, type,
width, height) of an image using PHP image functions?Answer : 36 To
know the Image type use exif_imagetype () functionTo know the Image
size use getimagesize () functionTo know the image width use
imagesx () functionTo know the image height use imagesy() function.
Question : 37 How can we get the browser properties using
PHP?Answer : 37 By using $_SERVER['HTTP_USER_AGENT']variable.
Question : 38 What is the maximum size of a file that can be
uploaded using PHP and how can we change this?Answer : 38 By
default the maximum size is 2MB. and we can change the
followingsetup at php.ini upload_max_filesize = 2M.Question : 39
How can we increase the execution time of a PHP script? Answer : 39
by changing the following setup at php.ini max_execution_time = 30;
Maximum execution time of each script, in seconds.Question : 40 How
can we take a backup of a MySQL table and how can we restore it.
?Answer : 40 To backup: BACKUP TABLE tbl_name[,tbl_name]
TO'/path/to/backup/directory'. RESTORE TABLE tbl_name[,tbl_name]
FROM '/path/to/backup/directory'mysqldump: Dumping Table Structure
and DataUtility to dump a database or a collection of database for
backup orfor transferring the data to another SQL server (not
necessarily a MySQLserver). The dump will contain SQL statements to
create the table and/orpopulate the table.Question : 41 How can we
optimize or increase the speed of a MySQL selectquery?Answer :
First of all instead of using select * from table1, use
selectcolumn1, column2, column3.. from table1 Look for the
opportunity to introduce index in the table you arequerying. Use
limit keyword if you are looking for any specific number ofrows
from the result set.Question : 42 How many ways can we get the
value of current session id? Answer : 42 session_id() returns the
session id for the current session. Question : 43 How can we
destroy the session, how can we unset the variable of a
session?Answer : 43 session_unregister to Unregister a global
variable from the currentsession session_unset to Free all session
variables.Question : 44 How can we set and destroy the cookie n
php?Answer : 44 By using setcookie(name, value, expire, path,
domain); function we can set the cookie in php ;Set the cookies in
past for destroy. like setcookie("user", "sonia", time()+3600); for
set the cookie setcookie("user", "", time()-3600); for destroy or
delete the cookies;Question : 45 How many ways we can pass the
variable through the navigation between the pages?Answer : 45.
GET/QueryString POSTQuestion : 46 What is the difference between
ereg_replace() and eregi_replace()?Answer : 46 eregi_replace()
function is identical to ereg_replace() except thatthis ignores
case distinction when matching alphabeticcharacters.eregi_replace()
function is identical to ereg_replace()except that this ignores
case distinction when matching alphabeticcharacters.Question : 47
What are the different functions in sorting an array?Answer : 47
Sort(), arsort(),asort(), ksort(),natsort(), natcasesort(),rsort(),
usort(),array_multisort(), and uksort().Question : 48 How can we
know the count/number of elements of an array? Answer : 48 2 waysa)
sizeof($urarray) This function is an alias of count()b)
count($urarray)Question : 49 what is session_set_save_handler in
PHP? Answer : 49 session_set_save_handler() sets the user-level
session storage functions which are used for storing and retrieving
data associated with a session. This is most useful when a storage
method other than those supplied by PHP sessions is preferred. i.e.
Storing the session data in a local database. Question : 50 How can
I know that a variable is a number or not using aJavaScript?Answer
: 50 bool is_numeric ( mixed var) Returns TRUE if var is a number
or a numeric string, FALSE otherwise.or use isNaN(mixed var)The
isNaN() function is used to check if a value is not a number.
Question : 51 List out some tools through which we can draw E-R
diagrams for mysql. Answer : 51 Case Studio Smart Draw.Question :
52 How can I retrieve values from one database server and store
them in other database server using PHP?Answer : 52 we can always
fetch from one database and rewrite to another. hereis a nice
solution of it.$db1 =
mysql_connect("host","user","pwd")mysql_select_db("db1",
$db1);$res1 = mysql_query("query",$db1);$db2 =
mysql_connect("host","user","pwd")mysql_select_db("db2",
$db2);$res2 = mysql_query("query",$db2);At this point you can only
fetch records from you previous ResultSet,i.e $res1 But you cannot
execute new query in $db1, even if yousupply the link as because
the link was overwritten by the new db.so at this point the
following script will fail.$res3 = mysql_query("query",$db1);
//this will failSo how to solve that? take a look below.$db1 =
mysql_connect("host","user","pwd")mysql_select_db("db1",
$db1);$res1 = mysql_query("query",$db1);$db2 =
mysql_connect("host","user","pwd", true)mysql_select_db("db2",
$db2);$res2 = mysql_query("query",$db2);So mysql_connect has
another optional boolean parameter whichindicates whether a link
will be created or not. as we connect to the$db2 with this optional
parameter set to 'true', so both link willremain live.now the
following query will execute successfully.$res3 =
mysql_query("query",$db1);Question : 53 List out the predefined
classes in PHP?Answer : 53 Directory stdClass
__PHP_Incomplete_Class exception php_user_filter.Question : 54 How
can I make a script that can be bi-language (supportsEnglish,
German)?Answer : 54 You can maintain two separate language file for
each of thelanguage. all the labels are putted in both language
files as variablesand assign those variables in the PHP source. on
runtime choose therequired language option. Question : 55 What are
the difference between abstract class and interface?Answer : 55
Abstract class: abstract classes are the class where one or
moremethods are abstract but not necessarily all method has to be
abstract.Abstract methods are the methods, which are declare in its
class but notdefine. The definition of those methods must be in its
extending class.Interface: Interfaces are one type of class where
all the methods areabstract. That means all the methods only
declared but not defined. Allthe methods must be define by its
implemented class.Question : 56 How can we send mail using
JavaScript?Answer : 56 JavaScript does not have any networking
capabilities as it isdesigned to work on client site. As a result
we can not send mails usingJavaScript. But we can call the client
side mail protocol mailtovia JavaScript to prompt for an email to
send. this requires the clientto approve it. Question : 57 How can
we repair a MySQL table?Answer : 57 The syntex for repairing a
MySQL table isREPAIR TABLENAME, [TABLENAME, ],
[Quick],[Extended]This command will repair the table specified if
the quick is given theMySQL will do a repair of only the index tree
if the extended is givenit will create index row by row.Question :
58 What are the advantages of stored procedures, triggers,
indexes?Answer : 58 A stored procedure is a set of SQL commands
that can be compiled and stored in the server. Once this has been
done, clients don't need tokeep re-issuing the entire query but can
refer to the stored procedure.This provides better overall
performance because the query has to beparsed only once, and less
information needs to be sent between theserver and the client. You
can also raise the conceptual level by havinglibraries of functions
in the server. However, stored procedures ofcourse do increase the
load on the database server system, as more ofthe work is done on
the server side and less on the client (application)side.Triggers
will also be implemented. A trigger is effectively a type ofstored
procedure, one that is invoked when a particular event occurs.For
example, you can install a stored procedure that is triggered
eachtime a record is deleted from a transaction table and that
storedprocedure automatically deletes the corresponding customer
from acustomer table when all his transactions are deleted.Indexes
are used to find rows with specific column values quickly.Without
an index, MySQL must begin with the first row and then readthrough
the entire table to find the relevant rows. The larger thetable,
the more this costs. If the table has an index for the columns
inquestion, MySQL can quickly determine the position to seek to in
themiddle of the data file without having to look at all the data.
If atable has 1,000 rows, this is at least 100 times faster than
readingsequentially. If you need to access most of the rows, it is
faster toread sequentially, because this minimizes disk
seeks.Question : 59 What is the maximum length of a table name,
database name, and fieldname in MySQL?Answer : 59 The following
table describes the maximum length for each type ofidentifier.
IdentifierMaximum
Length(bytes)Database64Table64Column64Index64Alias255There are some
restrictions on the characters that may appear
inidentifiers:Question : 60 How many values can the SET function of
MySQL take? Answer : 60 MySQL set can take zero or more values but
at the maximum it cantake 64 values.Question : 61 What are the
other commands to know the structure of table using MySQL commands
except explain command?Answer : 61 describe Table-Name;Question :
62 How many tables will create when we create table, what are
they?Answer : 62 The '.frm' file stores the table definition.The
data file has a '.MYD' (MYData) extension.The index file has a
'.MYI' (MYIndex) extension.Question : 63 What is the purpose of the
following files having extensions 1) .frm 2) .myd 3) .myi? What do
these files contain?Answer : 63 In MySql, the default table type is
MyISAM.Each MyISAM table is stored on disk in three files. The
files have namesthat begin with the table name and have an
extension to indicate thefile type.The '.frm' file stores the table
definition.The data file has a '.MYD' (MYData) extension.The index
file has a '.MYI' (MYIndex) extension.Question : 64 What is maximum
size of a database in MySQL? Answer : 64 If the operating system or
filesystem places a limit on the numberof files in a directory,
MySQL is bound by that constraint.The efficiency of the operating
system in handling large numbers of files in a directory can place
a practical limit on the number of tables in a database. If the
time required to open a file in the directory increases
significantly as the number of files increases, databaseperformance
can be adversely affected. The amount of available disk space
limits the number of tables.MySQL 3.22 had a 4GB (4 gigabyte) limit
on table size. With the MyISAM storage engine in MySQL 3.23, the
maximum table size was increased to65536 terabytes (2567 1 bytes).
With this larger allowed table size,the maximum effective table
size for MySQL databases is usually determined by operating system
constraints on file sizes, not by MySQL internal limits.The InnoDB
storage engine maintains InnoDB tables within a tablespace that can
be created from several files. This allows a table to exceed the
maximum individual file size. The tablespace can include raw disk
partitions, which allows extremely large tables. The maximum
tablespace size is 64TB. The following table lists some examples of
operating system file-sizelimits. This is only a rough guide and is
not intended to be definitive.For the most up-to-date information,
be sure to check the documentationspecific to your operating
system.Operating System File-size. LimitLinux 2.2-Intel 32-bit 2GB
(LFS: 4GB) Linux 2.4+ (using ext3 filesystem) 4TBSolaris 9/10
16TBNetWare w/NSS filesystem 8TBWin32 w/ FAT/FAT32 2GB/4GBWin32 w/
NTFS 2TB (possibly larger)MacOS X w/ HFS+ 2TB.Question : 65 Give
the syntax of Grant and Revoke commands?Answer : 65 The generic
syntax for grant is as following GRANT [rights] on [database/s] TO
[username@hostname] IDENTIFIED BY [password] now rights can bea)
All privilegesb) combination of create, drop, select, insert,
update and delete etc.We can grant rights on all databse by using
*.* or some specificdatabase by database.* or a specific table by
database.table_nameusername@hotsname can be either
username@localhost, username@hostnameand username@%where hostname
is any valid hostname and % represents any name, the *.*any
conditionpassword is simply the password of userThe generic syntax
for revoke is as followingREVOKE [rights] on [database/s] FROM
[username@hostname] now rights can be as explained abovea) All
privilegesb) combination of create, drop, sel