Monthly Archives: September 2017

QUICK ENQUIRY FORM



WHAT WILL HAPPEN WHEN YOU SUBMIT THIS FORM

  • After submitting the enquiry, you will be contacted by our team.
  • Payilagam Team will get to know about your training needs.
  • They will update you how could they help you.
  • Trainers(IT Professionals) may contact you if you need any clarification.
  • Your contact information will be kept highly confidential & not be shared to 3rd Parties.
Quick Enquiry

Top 50 PHP INTERVIEW QUESTIONS – Part 1

1) What do you know about php? 2) Write different comments in php? 3) How to declare constant in php? 4) Write any four magic constants in php? 5) Write any 5 super global variable in php? 6) What is the difference between echo and print? 7) What is the difference between post and get? 8) Why we use request in php? 9) What is timestamp in php? 10) How to create, write, read and delete a file in php? 11) How to check the file in php? 12) How to validate IP address in php? 13) What is the difference between include and require? 14) Calculate the length of “PAYILAGAM”. 15)Extract “YILAG” from “PAYILAGAM”. 16) How to remove “PYM” from “PAYILAGAM”. 17) How to declare a variable in php? 18) What is the difference between print_r and var_dump 19) What is the difference between implode and explode. 20) Array: Length, combine, sort(all sortings with key and values), size, structure, shuffle, push, pop, map, reverse, search, shift, slice, unique, multi_sort, pad, compact. 21) What do you know about session and cookie. 22) How to calculate date in php? 23) How to use a global variable as a local variable. 24) Write a query for create a table in php? ( Go through All MySql queries). 25) How to connect php with mysql server. 26) How to insert a data into mysql database. 27) How to retrieve a data from database in php. 28) How to update a data in database in php. 29) How to retrieve all table from database in php. 30) How to retrieve all database from mysql server in php. 31) What is class. 32) what is object? 33) what is the […]

By |September 24th, 2017|Blogs|0 Comments

Addition of Consecutive Digits in a given Number Program

Addition of Consecutive Digits in a given Number Program In this blog we are going to discuss about Addition of Consecutive Digits in a given Number Program . They are illustrated very well below : ______________________________________________________________________________________ Hi, In this post, we are going to discuss Addition of Consecutive Digits in a given Number program. Add numbers by below Method We can take n numbers, For Example We can take 5, for this, we should take 1-5.  Now, we need to add the consecutive digits in the given number 5. (1+2)+(2+3)+(3+4)+(4+5)  = 24 Addition of Consecutive Digits in a given Number – Program: public class Program { public static void main(String[] args) { int result=0,i,a=0; System.out.print(“Enter the number of n value”+” “); int num; Scanner scan = new Scanner(System.in); num = scan.nextInt(); for(i=1;i<num;i++){ int n=i; a= n+(++n); result=result+a; } System.out.println(“Total of n number is”+” ” +result); } } Also there is a java run program given below :  // Java program to print a consecutive sequence // to express N if possible. class GfG {     // Print consecutive numbers from     // last to first     static void printConsecutive(int last, int first)     {         System.out.print(first++);         for (int x = first; x<= last; x++)             System.out.print(” + “+x);     }              static void findConsecutive(int N)     {         for (int last=1; last<N; last++)         {             for (int first=0; first<last; first++)             {                 if (2*N == (last-first)*(last+first+1))                 {                     System.out.printf(N + ” = “);                     printConsecutive(last, first+1);                     return;                 }             }         }         System.out.print(“-1”);     }            // main function     public static void main (String[] args)      {         int n = 12;         findConsecutive(n);     } }

By |September 24th, 2017|Blogs|0 Comments

Data Retrieval from Database in PHP – With Coding

Data Retrieval from Database in PHP – With Coding This blog explains about Data Retrieval from Database in PHP – With Coding and is explained below : _______________________________________________________________________________ Hi, Today we are going to know about how to retrieve data from database.  Here we are using mysql_fetch_array(); to get a particular row values. It stored all values in an array. Then we will call all values by its index names. Retrieve or Fetch Data From Database As we know Database is a collection of tables that stores data in it. To retrieve or fetch data from MySQL database it is simple to do it using MySQL ” Select” query in PHP . Using PHP script insert user entered data/information into database and extract/fetch data stored in database and display it on the browser. Releasing Memory Its a good practice to release cursor memory at the end of each SELECT statement. This can be done by using PHP function mysql_free_result(). Below is the example to show how it has to be used. Example Try out following example <?php $dbhost = ‘localhost:3036’; $dbuser = ‘root’; $dbpass = ‘rootpassword’; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die(‘Could not connect: ‘ . mysql_error()); } $sql = ‘SELECT emp_id, emp_name, emp_salary FROM employee’; mysql_select_db(‘test_db’); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die(‘Could not get data: ‘ . mysql_error()); } while($row = mysql_fetch_array($retval, MYSQL_NUM)) { echo “EMP ID :{$row[0]} <br> “. “EMP NAME : {$row[1]} <br> “. “EMP SALARY : {$row[2]} <br> “. “——————————–<br>”; } mysql_free_result($retval); echo “Fetched data successfully\n”; mysql_close($conn); ?> __________________________________________________________________________________________________ Ok. This is our program, <?php $dbhost=”localhost”;      $dbuser=”root”;      $dbpass=””;      $conn=mysql_connect($dbhost,$dbuser,$dbpass);      mysql_select_db(“trainee”);      $result = mysql_query(“select * from details      […]

By |September 12th, 2017|Blogs|0 Comments

Inserting Data in Table through PHP – With Coding

Inserting Data in Table through PHP – With Coding This blog explains about Inserting Data in Table through PHP – With Coding . It is illustrated very well below : _______________________________________________________________________________ Hi, We have learned how to create table in last program. This program shows how to insert new data into the created table. Ok, Lets see the program We have divided this chapter in the following sections − Connecting to MySQL database − Learn how to use PHP to open and close a MySQL database connection. Create MySQL Database Using PHP − This part explains how to create MySQL database and tables using PHP. Delete MySQL Database Using PHP − This part explains how to delete MySQL database and tables using PHP. Insert Data To MySQL Database − Once you have created your database and tables then you would like to insert your data into created tables. This session will take you through real example on data insert. Retrieve Data From MySQL Database − Learn how to fetch records from MySQL database using PHP. Using Paging through PHP − This one explains how to show your query result into multiple pages and how to create the navigation link. Updating Data Into MySQL Database − This part explains how to update existing records into MySQL database using PHP. Deleting Data From MySQL Database − This part explains how to delete or purge existing records from MySQL database using PHP. Using PHP To Backup MySQL Database − Learn different ways to take backup of your MySQL database for safety purpose.   Data can be entered into MySQL tables by executing SQL INSERT statement through PHP function mysql_query. Below a simple example to insert a record into employee table.   <?php /* Insert data into table */ $host = “localhost”; […]

By |September 12th, 2017|Blogs|0 Comments

Creating table in PHP – With Program

Creating table in PHP – With Program This blog explains about Creating table in PHP – With Program . It is explained clearly well below : _____________________________________________________________________________________ Creating Tables inside MySQL Database Using PHP In the previous chapter we’ve learned how to create a database on MySQL server. Now it’s time to create some tables inside the database that will actually hold the data. A table organizes the information into rows and columns. The SQL CREATE TABLE statement is used to create a table in database. Let’s make a SQL query using the CREATE TABLE statement, after that we will execute this SQL query through passing it to the PHP mysqli_query() function to finally create our table. We have created a database “trainee” in last program. Now we are going to create a table inside the database “trainee”. I am assume a table name is details and columns are Name, Father and Mobile, all are having the length 20. Ok Let us go to the program, <?php /* Create New Table */ $host = “localhost”; $user = “root”; $pass = “”; $connect=mysql_connect($host, $user, $pass); mysql_select_db(“trainee”); // Select your created database to create new table $query=”create table Details(Name varchar(20), Father varchar(20), Mobile varchar(20))”; $mysql=mysql_query($query); if($mysql) { echo “New Table is created successfully”; } ?> OUTPUT: New Table is created successfully The PHP code in the above example creates a table named persons with four columns id, first_name, last_name and email inside the demo database. Notice that each field name is followed by a data type declaration; this declaration specifies what type of data the column can hold, whether integer, string, date, etc. There are a few additional constraints (also called modifiers) that are specified after the column name in the preceding SQL statement, like NOT NULL, PRIMARY KEY, AUTO_INCREMENT, etc. Constraints define rules regarding the values allowed […]

By |September 12th, 2017|Blogs|0 Comments

View Database in PHP – With Coding

View Database in PHP – With Coding This blog explains about View Database in PHP – With Coding . It is explained very well below : ______________________________________________________________________________ Hi, In last program, we have created a database “trainee”. Now we are going to see a created database by using given PHP program. You know very well how to connect and create new database, here we have used mysql_fetch_assoc(); to stores all databases in an associative array. The stored databases was selected by using while loop. Data can be fetched from MySQL tables by executing SQL SELECT statement through PHP function mysql_query. You have several options to fetch data from MySQL. The most frequently used option is to use function mysql_fetch_array(). This function returns row as an associative array, a numeric array, or both. This function returns FALSE if there are no more rows. Below is a simple example to fetch records from employee table. Example Try out following example to display all the records from employee table. Lets move into the program, <?php /* View All Databases */ $host = “localhost”; $user = “root”; $pass = “”; $connect=mysql_connect($host, $user, $pass); $query=”show databases”; $mysql=mysql_query($query); $row=mysql_fetch_assoc($mysql); // stores all databases as an associative array while($row=mysql_fetch_assoc($mysql)) { echo $row[‘Database’].”<br>”; } ?> OUTPUT: // The stored databases are information_schema mysql payilagam performance_schema phpmyadmin student test trainee // This is your last created database trainee In above example the constant MYSQL_ASSOC is used as the second argument to mysql_fetch_array(), so that it returns the row as an associative array. With an associative array you can access the field by using their name instead of using the index. PHP provides another function called mysql_fetch_assoc() which also returns the row as an associative array. REFERENCES : https://www.tutorialspoint.com/php/mysql_select_php.htm https://www.tutorialrepublic.com/php-tutorial/php-mysql-create-table.php

By |September 12th, 2017|Blogs|0 Comments

Creating Database in PHP – With Coding

Creating Database in PHP – With Coding This blog explains about Creating Database in PHP – With Coding . It is illustrated very well below : ______________________________________________________________________________ In last program we learned how to connect given database with PHP page. In this program, you can get an idea with how to create new database. If you have a basic knowledge in MySQL query, it will very helpful to understand to learn this PHP program. Ok, Lets see the program A database consists of one or more tables. You will need special CREATE privileges to create or to delete a MySQL database. Create a MySQL Database Using MySQLi and PDO The CREATE DATABASE statement is used to create a database in MySQL. Inserting Multiple Rows into a Table You can also insert multiple rows into a table with a single insert query at once. To do this, include multiple lists of column values within the INSERT INTO statement, where column values for each row must be enclosed within parentheses and separated by a comma. The following examples create a database named “myDB”: <?php /* Create new  database */ $host = “localhost”; $user = “root”; $pass = “”; $connect=mysql_connect($host, $user, $pass); $query=”create database Trainee”; // This is your MySQL query(Database name is: Trainee) $mysql=mysql_query($query); // executes a query on a MySQL database. if($mysql) { echo “New Database is created successfully”; } ?> OUTPUT: New Database is created successfully Prerequisites For the purpose of this tutorial on creating PHP contact form with MySQL, I assume that you have a PHP application installed on a web server. My setup is: PHP 7.1 MySQL Jquery/Ajax To make sure that that I don’t get side-tracked by server level issues, I decided to host PHP application on Cloudways managed servers […]

By |September 12th, 2017|Blogs|0 Comments

Database connection in PHP

Database Connection in PHP  This blog explains about Database Connection in PHP and is illustrated very well below : _______________________________________________________________________________ Hi,        This post gives an information about how to connect PHP page to MariaDB. First open your admin page by using this url -> http://localhost/phpmyadmin/ now you can see the admin page. How to connect to MySQL using PHP This article describes several methods for connecting to a MySQL database using PHP: MySQL Improved (mysqli) extension PDO (PHP Data Objects) Legacy MySQL (mysql_) functions Connecting to a remote MySQL database using PHP The MySQL databases and users must already exist before you can use these methods. For information about how to manage MySQL databases using cPanel In that page, you can see the user account in menu. Now select user account, here you can see the username and password of host which you have used as a server. CONNECTING TO MYSQL USING THE MYSQL IMPROVED EXTENSION The MySQL Improved extension uses the mysqli class, which replaces the set of legacy MySQL functions. To connect to MySQL using the MySQL Improved extension, follow these steps: Use the following PHP code to connect to MySQL and select a database. Replace username with your username, password with your password, and dbname with the database name: <?php $mysqli = new mysqli(“localhost”, “username”, “password”, “dbname”); ?> After the code connects to MySQL and selects the database, you can run SQL queries and perform other operations. For example, the following PHP code runs a SQL query that extracts the last names from the employees table, and stores the result in the $result variable: Here you can create your own username and password also or you can choose given username and password for connecting PHP with Database. The following program shows […]

By |September 12th, 2017|Blogs|0 Comments

Check Palindrome in PHP with Program

Check Palindrome in PHP with Program This blog explains about Check Palindrome in PHP with Program . They are illustrated very well below : _______________________________________________________________________________ Hi,      I give an idea to check a given string is palindrome or not in php. In php, we use the “.” symbol for concatenating two strings. First of all, we should calculate the given string by using strlen(). I am considering the variable $x=”AMMA”; Here the length of the string is 4. We can get the every character from its indexes of  $x[0], $x[1], $[2], $x[3]. Each index values gives A, M, M, A. Then we should concatenate from last index with its previous index values till  its  starting index values by using the for loop. Ok, Let see program: <?php $x=”AMMA”; $n=””; $m=strlen($x); for($i=$m-1; $i>-1; $i–) { $n=$n.$x[$i]; } echo $n.”<br>”; if($x==$n) { echo “Given string is palindrome”; } ?>   OUTPUT: AMMA Given string is palindrome ____________________________________________________________________                                                   Check for Palindrome number Here we have simply used the iterative way to check for the palindrome number. Each digit is extracted in an iteration and formed the reverse number and finally, it is checked, whether it is same as the original number. Method 1: Using strrev() The strrev() function is used in PHP to reverse a string. We can simply use this method to reverse the string and match it with the previous value. If it is a match, then the string is palindrome else not. Example: <?php // PHP code to check for Palindrome string in PHP // Using strrev() function Palindrome($string){       if (strrev($string) […]

By |September 6th, 2017|Blogs|0 Comments

Find Armstrong Number in PHP with Program

Find Armstrong Number in PHP with Program This blog explains about Find Armstrong Number in PHP with Program . They are explained very well below :  _______________________________________________________________________________ Hi, Find Armstrong Number in PHP With Program – This is one of the interview questions usually asked.  PHP | Check if a number is armstrong number Given a number, we need to check whether it is an armstrong number or not in PHP. An Armstrong number is the one whose value is equal to the sum of the cubes of its digits. Examples: Input : 407 Output : Yes 407 = (4*4*4) + (0*0*0) + (7*7*7) = 64 + 0 + 343 = 407 Input : 303 Output : No In this program, we will check the sum of cube values of individual digits are equal to given  number or not. Let us consider the number is 370. Here 3 cube is 27 and 7 cube is 343 and 0 cube is 0. The sum of all cube value is 370. Aim:(3*3*3+7*7*7+0*0*0)   First(at $i=0) we find modulus with 10(370%10) it gives result  0. Then calculate cube value using pow() , add with $s and assign whole value into $s again. Next we need 37 for remaining operations so that we divide again the given with 10. Here we have used three digit number, hence we have set for loop runs at three time. When  $i=0, $r will become 7, so $s=343. At final loop($i=2) $r=3, and $s=370. It gives same number  what  we have given. Ok, Lets go to the program: <?php $m = 370; $r=0; $s=0; for($i=0; $i<3; $i++) { $r=$m%10; $s=$s+pow($r,3); // {($i=0), 0*0*0} + {($i=1), 0+ 7*7*7} + {($i=2), 343+ 3*3*3} $m = $m/10; } […]

By |September 6th, 2017|Blogs|0 Comments