Category Archives: PHP

Php Interview Questions and Answers – Part 9


1- How can we know that a session is started or not? A session starts by session_start() function. This session_start() is always declared in header portion. it always declares first. then we write session_register(). 2- What are the differences between  mysql_fetch_array(),  mysql_fetch_object(),  mysql_fetch_row()? Answer 1: mysql_fetch_array() -> Fetch a result row as a combination of associative array and regular array. mysql_fetch_object() -> Fetch a result row as an object. mysql_fetch_row() -> Fetch a result set as a regular array(). Answer […]

Select Records using PHP MySQL Select Statement

online tutorilas

You can use SELECT statement to select data from a database. Syntax SELECT column_name(s) FROM table_name To get PHP to execute the statement above we must use the mysql_query() function. This function is used to send a query or command to a MySQL connection. For Example: The following example selects all the data stored in the “student” table (The * character selects all the data in the table): <?php $con = mysql_connect(“localhost”,”username”,”password”); if (!$con) { die(‘Could not connect: ‘ . […]

Create a CSV file using PHP and MYSQL


As we know that CSV files are one of the most used way to back-up mysql database and tables. However it is very simple to export or backup your mysql database table as CSV file if you have PhpMyAdmin interface installed on your server. Actually problem arises when we have to deal with a shared hosting. But by using PHP script, you can export complete mysql database table to csv files. Here in this post I have given you a […]

Swapping Array Keys and Values

Swapping Array

In this article we discuss about Swapping Array Keys and Values. If you want interchange the keys and values of an associative array. It’s very easy, just use PHP’s array_flip() function which perform a very specialized task. It reverses the key-value relationship for all the elements of an associative array and returning a new array that is the mirror image of the original. <?php $opposite_key_value = array(“white” => “black”, “day” => “night”, “open” => “close”); print_r(array_flip($opposite_key_value)); ?>

Future of SEO – 20 Questions Asked By Webmasters

Future Of SEO

A campaign by Matt Cutts, the head of Google’s web-spam team for recording a video series for webmasters has received huge response from SEO enthusiasts around the world. Till date 1265 people have participated, 581 questions asked with a total of 13,531 votes . Webmasters and SEO practitioners have asked some interesting questions to Matt which may play an important role deciding the “Future Of SEO.” I have hand-picked and compiled 20 interesting questions for you, which may modify the […]

Php Interview Questions and Answers – Part 8

Php Interview Questions and Answers

Php Interview Questions and Answers – Part 8 1- Give the syntax of REVOKE commands? The generic syntax for revoke is as following REVOKE [rights] on [database] FROM [username@hostname] Now rights can be: a) ALL privileges b) Combination of CREATE, DROP, SELECT, INSERT, UPDATE and DELETE etc. We can grant rights on all database by using *.* or some specific database by database.* or a specific table by database.table_name. 2- What is the difference between CHAR and VARCHAR data types? […]

Top 20 Interesting Websites

Top 20 Interesting Websites

Getting bored? Wanna add some fun in your life? Don’t surf the internet aimlessly. I will tell you about top 20 interesting websites, where you like to spend some quality time for sure. In fact, there are plenty of interesting websites with unique concept and functionality, which can augment your day to day activities including entertainment, but most of the time people are unaware because of busy life. Lets surf top 20 interesting websites and add some zing in the […]

Top 20 WordPress Plugins For Bloggers

Top 20 WordPress Plugins

Plugins can add almost any imaginable functionality to your WordPress blog. With more than 23,000 free and 1000s of premium plugins available; life of a blogger has become very easy these days. I’m listing here – My collection of Top 20 WordPress Plugins for bloggers of every niche in 2014. Most of the plugins mentioned here are not only essential for every bloggers, but also the best in their respective categories like anti-spam, sitemap, security etc. 1. Akismet: The one […]

Sorting using MySQL ORDER BY Statement

Sorting using PHP MySQL ORDER BY Statement

We use Sorting using MySQL  Order by statement in a recordset.The ORDER BY keyword sort the records in ascending order by default. If you want to sort the records in a descending order, you can use the DESC keyword. SELECT column_name(s) FROM table_name ORDER BY column_name(s) ASC|DESC You can sort on multiple columns, and you can sort different columns in different directions This query would return me the results ordered by the species in the order I need and then sort […]

Php Interview Questions and Answers – Part 7


This is the 7th part of Php Interview Questions and Answers. 1- How can we destroy the session, how can we unset the variable of a session? session_unregister() – Unregister a global variable from the current session session_unset() – Free all session variables 2- What are the different functions in sorting an array? Sorting functions in PHP: asort() arsort() ksort() krsort() uksort() sort() natsort() rsort() 3- How can we know the count/number of elements of an array? 2 ways: a) sizeof($array) […]