Posts

Showing posts from January, 2021

How to get the Time Zone from IP address in PHP?

Using below PHP script, we can get the time zone based on IP address: $ip = '192.168.11.121';  # any working IP address $ipContent = file_get_contents('http://ip-api.com/json/' . $ip); $ipJsonInfo = json_decode($ipContent); $timeZone = $ipJsonInfo->timezone; #Print the $timeZone echo $timeZone; Here, also can set this time zone as default using below function: date_default_timezone_set($timeZone);

What is fully qualified name in MySQL database query?

 In query the field name aliased  by table name know as Fully Qualified name. Ex. SELECT employee.address FROM employee;

What is conjunctive operators in SQL?

 The SQL AND and OR conditions may be combined to test multiple conditions in query. These two operators are called conjunctive operators.

How to generate the random password in PHP?

 Using below PHP script, you can generate the random password: <?php  function generateRandomPassword() {         $salt = "abcdefghijklmnopqrstuvwxyz0123456789";         srand((double) microtime() * 1000000);         $i = 0;         while ($i <= 7) {              $num = rand() % 33;             $tmp = substr($salt, $num, 1);             $pass = $pass . $tmp;             $i++;         }         return $pass;     } echo generateRandomPassword();  // Calling the function ?>

How to use remote validation in JQuery?

 As per below example, we can use the remove validation into JQuery: email: { remote: { type: "POST", url: 'http://test.domainname.com/check_email.php', dataType: "json", beforeSend: function () {                                        // set loading image }, complete: function () {                                 // hide loading image }, data: { 'email': function () { return $('#email').val() } } } } Here, "check_email.php" is your remote file where you will verify the email. Which exist or not to your particular database table

How to set Timezone in .htaccess file?

Using below line, we can set the Timezone to .htaccess file. SetEnv AE Asia/Dubai

How to Drop or Delete the database by shell command in windows XAMPP?

 Generally, we can pass any query to mysql from shell with -e option as below: 1. First need to go in mysql/bin using cd mysql/bin command 2. mysql -u username -p -D "database name" -e "DROP DATABASE database name"

How to add new file in git ignore?

 For steps to add file in git ignore: 1. Go to .gitignore file and add the entry for the files or folder path you want to ignore. 2. git rm -r --cached . 3. git add . Note:  Whenever you find the file which is in git ignore file and still you are getting in git status then run the command as above.