Showing posts with label Interview. Show all posts
Showing posts with label Interview. Show all posts

Saturday 21 June 2014

.htaccess in PHP


.htaccess in PHP

It is simple plain text file. There are lots of use of .htaccess.

Url_rewriting
Deny visitors by IP address
redirect page
give permission to folder
password protection.

Action in Wordpress


Action in Wordpress

If you want to add additional code in wordpress core functionality then you can use action.

add_action(wp_head, myfunction);

ini_set() in PHP


ini_set() in PHP

It sets the value of configuration option.

ini_set("display_errors",1);

Filter in Wordpress


Filter in Wordpress

Filter are used to manipulate output like change formatting of content, override array.

add_filter("comment_text", "your_function");

Difference between truncate and delete in mysql ?


Difference between truncate and delete in mysql ?

Truncate is faster than delete. Truncate deletes all records from table and cannot retrieved where delete only delete selected record and can be retrieve when you rollack.

Friday 20 June 2014

What is inheritance PHP ?


What is inheritance?

By inheritance a class, we create a new class with all functionality of that existing class, and we can add new members to the new class. This way we can extend existing class without modifying its code.

When we inherit one class from another we say that inherited class is a subclass because it is created from another class.

class person{
var $name;
 function printpersonInfo()
  {
    echo $this->name;
  }

}

class employedPerson extends person{
 var $occupation;
 function printpersonInfo()
 {
   patent::printpersonInfo();
 }

what is foreign key in Mysql ?


what is foreign key in Mysql ?

Foreign key is used to establish the relationship among the tables. Foreign key type can be primary key, unique key or normal key of its table.suppose you want to manage data of authors and their books in the database. For this you have a table name "author". The author table has columns like "author_id", "author_name" to store authors info. To store books you have another table named "books". The books has columns like "book_id","book_name" and "author_id".

Here "author_id" is foreign key....

split() in PHP


split() in PHP

The split() function lets us break apart strings using regular expression to specify the matching string that will be used us the boundaries for that spliting.
Example :
$a = split(':', "one:two:three");

The preceding code returns an array with three strings in it namely one,two,three.

echo $a[0] => one
echo $[1] => two
echo $[2] => three

Thursday 19 June 2014

stristr() in php


stristr() in php

The stristr() function searches for the first occurrence of a string inside another string. This function returnns the rest of the strings (from the matching point) or False, if the string to search for is not found.

stristr(string,search);
Example :
<?php echo stristr("Hello world ! How are you?","world"); ?>

Output : world! How are you?

What is indexing/indexes ?


What is indexing/indexes ?

Indexes is a data structure that improves the speed of operations in a table. Indexes can be created one or more columns.

It is used to speed up queries and will be used by database search engine to locate rewards very fast.
Insert and update statements takes more time on tables having indexes where as select statement become fast on those tables. The reason is that while doing insert or update database need to insert or update index value as well.

Types:

B-Tree Indexes:
  Normal Index : Contain duplicate value.
  Unique Index : can not add duplicate value but you can add null.
  Primary key : can not add null and duplicate value.
  Full-text indexes : Us for full-text searches. Search some specific keyword from the text-column.

B-tree index can be used for column comparison in expression like =,>,>=,<,<= or between oparator.

Spatial Indexes(R-Tree):
       Spatial indexes is supported by only MYISAM storage engine.

Hash Indexes:
       Hash index supported only by memory storage engine. Here we can use only equality comparison where we can use = or != operators.

syntax :
Unique index :
Create unique index index_name
ON table_name(col1,col2)

Create unique index Author_index
ON tutorials_tbl(tutorial_autohr)

Simple Index :
Create index index_name
ON table_name(col1,col2);

Display index:

Show Index from table_name;

Sunday 15 June 2014

Database management system


Database management system

Database Management system sometime just called a database manager is a program that lets one or more computer users create and access data in database.

System for quick search and retrieval of information from a database. The DBMS determines how data are stored and retrived. It must address problems such as security, accuracy, consistency among different records response time and memory requirements.

RDBMS - The most typical DBMS is a Relational Database management system.
SQL - Structured query language
ODBMS - Object oriented database management system.

what is database server ?


what is database server ?

Refers to the back end system of a database application using client/server architecture. The back end sometimes called a database server performs tasks such as data analysis, storage, data manipulation, archiving and other non user specific tasks.

Saturday 14 June 2014

Difference between GET and POST


Difference between GET and POST

Using GET method is not secure your information will be appeared in the Url adress. Using POST method is much secure. It will appear in the url address. e.g. Loginform.

GET--> we can transfer limited data. GET() transfer only 256 characters.
POST--> We can transfer unlimited data.

What is the difference between a primary key and unique key.


What is the difference between a primary key and unique key.

Both primary key and unique enforce uniqueness of the column on which they are defined. But by default primary key creates a clustered index on the column, where are unique creates a non clustered index by default. Another major difference is that primary key doesnt allow Nulls, but unique key allows one Null only.

coockie in PHP


coockie

Cookie stores user Information like username and password.

setcookie(username,value,expire,pathe,domain);

Cache in PHP


Cache

Cache stores temporary data of website. Because of this it will increase the website performance. It will increase the speed performance. First time site will take time to load data but next time it will load fast because of cache. Data comes from cache.

Wednesday 11 June 2014

Session in PHP


Session in PHP

A Normal HTML website will not pass data from one page to another. In other words all Information is forgotten when new page is loaded. This makes it quite a problem for tasks like a shopping cart which requires data to be remembered from one page to the next.

A PHP session solves this problem by allowing you to store infomation on the server for later use.(i.e. username, shopping cart items etc..) However this session information is temporary and is usually deleted very quickly after the user has left the website.

<?php
session_start();
$_session['view'] = 1;
 ?>

For close session:
<?php
session_write_close();
session_destroy();
?>

What is array in PHP?


What is array in PHP?

An array is a variable that stores a set or sequence of values. One array can have many elements and each element can hold a single value such as text or numbers or another array. An array containing other arrays is known as a multidimensional array.

There are three types of array in PHP.

(1) Numeric array
(2) Associative array
(3) Multidimensioanl array

Numeric array : An Array with a numeric index. Values are stored and accessed in linear fashion.

Asscociative array : An array with strings as index. This stores element values in association with key values rather than in a strict linear index order.

Multidimension array : This array contain one or more array or sub-array.

Print_r() in PHP


Print_r() in PHP

The print_r() PHP function is used to return an array in a human readable form. It is simple written as print_r($yourname).

Example:

$array = array('chand'=> "good",'jigu'=>"also good");

Output:

Array( [chand] => good [jigu]=> also good)

How to declare/define class in PHP?


How to declare/define class in PHP?

Class classname
{
 var $variable name;
 function function name()
 {
   statements;
 }