Tag Archives: PHP

Difference between == and === in PHP

The operators  ‘==’  and ‘===’ are called comparison operators. These are mainly used used to compare the values. The main difference between == and === in PHP is shown below. == (equal) : It checks whether the Left side value is equal to the right side value. === ( identical) : It checks both the values and… Read More »

Remove element from an array in PHP

In this post we show how to remove element from an array in PHP to check an element from one array with another array and remove that element from the first array. The below code snippet will show how to remove that element by comparing the two arrays. $mainArray – is the main array from which… Read More »

PDO Prepared Statements

In general when we execute a SQL query the database will analyze, compile and optimize its plan for executing the query. If we are running an insert query for a table in the database with different values then we can use PDO Prepared Statements. PDO Prepared Statements will reduce the analyze, compile and optimization time of… Read More »

PHP : Connect to the MySQL Server – Part 3

PDO’s:- The PHP Data Objects new way to connect the Database in php programming. As the mysql_connect() is deprecated and mysqli_connect() functions do not support transaction mechanism PDO came into picture. PDO’s support  transactions - auto-commit, prepared statements, calling stored procedures and error handling. The easy way to use the PDO’s <?php $db = new PDO(‘mysql:host=localhost;dbname=testdb;charset=utf8′,… Read More »

PHP : Connect to the MySQL Server – Part 2

As mysql_connect() is deprecated from the PHP 5.5 version and above . So we use the mysqli_connect() function to connect the MySQL server. mysqli_connect() example :- Syntax:- mysqli_connect(<Server name/Host name >,<MySQL – Username>,<MySQL – Password>,<databsename>); <?php $dbLink = mysqli_connect( ‘localhost’, ‘username’, password’,’testDB’); if (!$dbLink ) {     die(‘Could not connect to the MySQL  Server: ‘ . mysqli_connect_error()); } echo ‘Database connection is successful.’; mysqli_close($dbLink ); ?> The… Read More »

PHP : Connect to the MySQL Server – Part 1

In order to connect to MySQL database using PHP we have multiple options. Before this we must have XAMPP installed in our system. 1. mysql_connect () - This extension is deprecated as of PHP 5.5.0, and will be removed in the future. 2. mysqli_connect — Alias of mysqli::__construct() 3. PDO -  PHP Data Objects (PDO). mysql_connect() example :- Syntax:- mysql_connect( <Server name/Host name >,<MySQL… Read More »

Display TinyMCE Editor hidden buttons in WordPress

This post will help us how to display TinyMCE Editor hidden buttons in WordPress . We need to add the following lines of code in functions.php file. /** * To enable hidden buttons in the Tiny MCE Editor. */ function enable_more_buttons($buttons) { $buttons[] = ‘fontselect’; $buttons[] = ‘fontsizeselect’; $buttons[] = ‘styleselect’; $buttons[] = ‘backcolor’; $buttons[]… Read More »

Codeigniter Session Issues with core library

In this post we will know the integration of native PHP session library to the CodeIgniter Session library in cases where we face session related issues. If your are facing problems with CodeIgniter core session library like saving session after user log-in, etc., then in such cases we can replace the code in core session.php file in… Read More »

Configuring php mail in xampp

For Configuring php mail in xampp we need to make the following changes in the XAMPP. First edit your php.ini (xampp\php\php.ini). Search for [mail function]  and change these parameters accordingly. SMTP = smtp.gmail.com smtp_port = 587 sendmail_from = [your_gmail_username]@gmail.comUncomment the line sendmail_path = “\”D:\xampp\sendmail\sendmail.exe\” -t” Note: this gmail account will be used to send the emails… Read More »