Most Essential And Frequently Asked Interview Questions And Answer
mysqli_fetch_assoc() function fetch a result row as an associative array where as mysqli_fetch_array() function fetch a result row as an associative array, a numeric array, or both.View Detials
mysqli_fetch_object() fetch a result row as an object where as mysqli_fetch_array() fetch a result row as an associative array, a numeric array, or both.View Detials
The three different way in PHP to connect with MySQL is:
Note: We should use MySQLI because MySQLI is imporoved version of MySQL and have more function then MySQL.
There are 4 ways:
OPTIMIZE command is use for optimize a table.
OPTIMIZE TABLE `users`
For increaseing the speed of a query we have to do couple of things
Bellow code is use for the same
$sql = "SELECT * FROM table1"; $result = mysql_query($sql, $db_link); $num_rows = mysql_num_rows($result); echo $num_rows;
DATEDIFF function is use for finding the number of days between two given dates using MySQL
There are 5 different types of storage engine present in MySql.
MyISAM is the default storage engine for MySQL
Mostly we use:
utf8_general_ci is use for fast sorting but it is less accurate whereas utf8_unicode_ci is used for better accuracy but little slow as compare to utf8_general_ci.
We can also use other collation based on specific languages like utf8_swedish_ci.
Cross-site scripting (XSS) is a type of computer security vulnerability typically found in web applications. XSS enables attackers to inject client-side script into web pages viewed by other users. A cross-site scripting vulnerability may be used by attackers to bypass access controls such as the same-origin policy.
By using mysql function mysqli_insert_id() we can retrive the last inserted id in database table.