how can retrieve data in a result set of mysql using php

1. Using mysql_fetch_row function. This will return an indexed array.
2. Using mysql_fetch_array function. Fetch a result row as an associative array, a numeric array, or both.
3. Using mysql_fetch_object function. This will return the result set as an object.
4. Using mysql_fetch_assoc function. This will Fetch a result row as an associative array

difference between include and include_once in php

difference between include and include_once in php 
Both statements includes and evaluates the specified file during the execution but as the name implies include_once will only include one time.

difference between split() explode() fuction php

 difference between split()  explode() fuction php

Split() is used to split a string using a regular expression, while explode() is used to split a string using another string.

how can redirect pages in php

how can redirect pages in php
header() function.
eg:- header(‘Location:interview_questions.php’);
This must be called before any output is called.

difference between “echo” and “print” in PHP?

difference between “echo” and “print” in PHP?

echo is a constructor and print is a function.echo cannot take arguments but print can take arguments.

$_GET and $_POST variables in php

$_get variables will be displayed in the browser's address bar, when using $_get variables form submission all variable names and values are displayed in the URL. Get variables not suit for large values pass 
 $_POST variables
Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send.

php loops

  • while 
  • do...while
  • for 
  • foreach

kind of arrays in php

  • Numeric array 
  • Associative array 
  • Multidimensional array

strpos() function in php

strpos function used search character and text with in string,if function found matches will return matches first position otherwise return FALSE.

<?phpecho strpos("Hello,",",");

it will be return 6

download file in php scripts

download file in php scripts

$path = $_SERVER['DOCUMENT_ROOT']."/file/";
$fullPath = $path.$current_file;
if ($fd = fopen ($fullPath, "r")) {
    $fsize = filesize($fullPath);
    $path_parts = pathinfo($fullPath);
    $ext = strtolower($path_parts["extension"]);
    switch ($ext) {
        case "pdf":
        header("Content-type: application/zip"); // add here more headers for diff. extensions
        header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\""); // use 'attachment' to force a download
        header("Content-type: application/octet-stream");
        header("Content-Disposition: filename=\"".$path_parts["basename"]."\"");
    header("Content-length: $fsize");
    header("Cache-control: private"); //use this to open files directly
    while(!feof($fd)) {
        $buffer = fread($fd, 2048);
        echo $buffer;
fclose ($fd);
// example: place this kind of link into the document where the file download is offered:

php register_globals meaning

php register_globals meaning

 a common security problem with PHP is the register_globals setting in PHP's configuration file (php.ini). This setting (which can be either On or Off) tells whether or not to register the contents of the EGPCS (Environment, GET, POST, Cookie, Server) variables as global variables.

what is the difference between http and https

 difference between http and https

The Hypertext Transfer Protocol (HTTP) is a networking protocol for distributed, collaborative, hypermedia information systems.[1] HTTP is the foundation of data communication for the World Wide Web.

Hypertext Transfer Protocol Secure (HTTPS) is a combination of the Hypertext Transfer Protocol (HTTP) with SSL/TLS protocol to provide encrypted communication and secure identification of a network web server.