Posts

Showing posts from October, 2015

Difference between unset() and unlink() in PHP

In PHP unlink() is a function for file system handling, unlink() is used to delete files (physical). Suppose you have uploaded a file and wants to delete this file through the coding then unlink() function is used to delete the file, Suppose you have an image with the name test.png and you wants to delete this image then use the <?php /****Condition*****/ /****Condition*****/ unlink(image path/test.png); /****Condition*****/ /****Condition*****/ ?> or <?php $xx = fopen('testing.html', 'a'); fwrite($xx, '<h1>Hello EWA!</h1>'); fclose($xx); unlink('testing.html'); ?> unset() is a function for variable management. It will make a variable undefined. Or we can say that unset() is used to null out the value of a given variable. OR Unset () is used to destroy a variable in PHP. In can be used to remove a single variable, multiple variables, or an element from an array. Example for unset() : <?php $value =

List of MySQLi function

The MySQLi functions allow you to access MySQL database servers. Note: The MySQLi extension is designed to work with MySQL version 4.1.13 or newer. Function Description mysqli_affected_rows() Returns the number of affected rows in the previous MySQL operation mysqli_autocommit() Turns on or off auto-committing database modifications mysqli_change_user() Changes the user of the specified database connection mysqli_character_set_name() Returns the default

PHP isset() vs empty() vs is_null()

PHP has different functions which can be used to test the value of a variable. Three useful functions for this are isset(), empty() and is_null(). All these function return a boolean value. If these functions are not used in correct way they can cause unexpected results. isset() and empty() are often viewed as functions that are opposite, however this is not always true. In this post I will explain the differences between these functions. isset() From PHP manual – isset(): isset — Determine if a variable is set and is not NULL In other words, it returns true only when the variable is not null. empty() From PHP Manual – empty(): empty — Determine whether a variable is empty In other words, it will return true if the variable is an empty string, false, is_null() From PHP Manual – is_null(): is_null — Finds whether a variable is NULL In other words, it returns true only when the variable is null. is_null() is opposite of isset(), except for one difference that i

AJAX Interview Questions

1) What are the usages of SQL? To execute queries against a database To retrieve data from a database To inserts records in a database To update records in a database To delete records from a database To create new databases To create new tables in a database To create views in a database 2) Does SQL support programming? No, SQL doesn't have loop or Conditional statement. It is used like commanding language to access databases. 3) What are the subsets of SQL? Data definition language (DDL) - Data definition language(DDL) allows you to CREATE, ALTER and DELETE database objects such as schema, tables, view, sequence etc. Data manipulation language (DML) - Data manipulation language makes user able to access and manipulate data. It is used to perform following operations. Insert data into database Retrieve data from the database Update data in the database Delete data from the database Data control language (DCL) - Data control