PHP Tutorials

Create Dynamic Tree View Menu with PHP, MySQL, CSS

In this tutorial I will describe how to create dynamic tree view menu with PHP, MySQL, CSS. If you want to display menu items as a tree view structure following tutorial will help you. Steps to generate tree view menu: Step 1: First we need to create a table ‘items’ in MySQL database. This table contains four column, The column id is the item id and name is the item …

Continue reading

How to use the PHP Ternary Operator

In this tutorial I will show you how to use the PHP ternary operator. PHP Ternary operator logic is the process of using “(condition) ? (true return value) : (false return value)” statements to shorten your if/else structures. It is called the ternary operator because it takes three operands – a condition, a result for true, and a result for false. Following example with if/else logic: Ternary Operator Ternary operator …

Continue reading

PHP Interview Questions and Answers Set – 5

In this tutorial we are providing some set of frequently asked PHP Interview Questions for experienced candidates which will help them to get success in interview. Read PHP Interview Questions and Answers Set – 4. What is the difference between ereg_replace() and eregi_replace()? The function eregi_replace() is identical to the function ereg_replace() except that it ignores case distinction when matching alphabetic characters. Is it possible to protect special characters in …

Continue reading

PHP Interview Questions and Answers Set – 4

In this tutorial we are providing some set of frequently asked PHP Interview Questions for experienced candidates which will help you to get success in interview. Read PHP MySQL Interview Questions and Answers Set – 3. How to find current date and time? The date() function provides you with a means of retrieving the current date and time, applying the format integer parameters indicated in your script to the timestamp …

Continue reading

PHP MySQL Interview Questions and Answers Set – 3

In this tutorial we are providing some set of frequently asked PHP MySQL Interview Questions which will help you to get success in interview. Read PHP interview questions and answers Set – 2. How can we connect to a MySQL database from a PHP script? To be able to connect to a MySQL database, we must use mysql_connect() function as follows: What is the function mysql_pconnect() usefull for? mysql_pconnect() ensure …

Continue reading

PHP interview questions and answers Set – 2

In this tutorial we are providing new set of some frequently asked PHP Interview Questions which will help you to get success in interview session easily. Read previous set PHP interview questions and answers. What should we do to be able to export data into an Excel file? The most common and used way is to get data into a format supported by Excel. For example, it is possible to …

Continue reading

PHP interview questions and answers

In this tutorial we are providing you some frequently asked PHP Interview Questions which will help you to get success in interview session easily. PHP is an important part of the web world, and every web developer should have the basic knowledge in PHP. Common PHP interview questions, which should help you become a best PHP developer. What is PHP? PHP is a server side scripting language commonly used for …

Continue reading

Convert Data from MySQL to JSON using PHP

Convert Data from MySQL to JSON using PHP

Converting data from MySQL to JSON format in PHP, is one of the most prominent task in web development. JSON is the most preferred data format over xml as data exchange between web and mobile applications. JSON format has it’s own advantages like light weight, ability to store complex data structures in plain text and human readability. In previous post we have already discussed about converting JSON data into MySQL …

Continue reading