Showing posts with label MYSQL. Show all posts
Showing posts with label MYSQL. Show all posts

Tuesday, May 26, 2020

XAMPP : Upgrade PHP and MySQL to latest Version

Many of us work on multiple projects and on long term projects also. While working condition may arise to upgrade PHP version for a project on your local development server. We just can't remove our old installation as it would also impact our old projects as old projects might be completely lost in this process.
A better way to handle this is that we might want to upgrade the existing XAMPP version to match the required PHP and MySQL version. This can be done by following the below steps.
  1. First of all take a backup of your existing htdocs and data folder (it is a subfolder of MySQL folder in XAMPP).
  2. In case you have made some changes in the configuration files like php.ini, httpd.config or any other files, than please take backup of those files also.
  3. Download the latest Version of XAMPP from their official website. (https://www.apachefriends.org/download.html)
  4. Now, reinstall the downgraded version and replace those folders with the old ones.
  5. After this replace the php.ini, httpd.config and other configuration files if you have taken backup.
With the above steps your PHP and MySQL Version will be upgraded to the latest version.

Monday, October 14, 2019

WordPress LearnDash Course Completion URL filter

If you want to set the completion URL as a custom one so that after completion of course user will be sent to this URL instead of the default LearnDash URL than can use the following available filter of LearnDash with WordPress.

 add_filter("learndash_course_completion_url", function($link, $course_id) {
//You can change the link here
return $link;
}, 5, 2);

You can set or change the priority of the filter execution as per your need or keep it as it is.

WordPress LearnDash Quiz Completion Hook

If you want to call a hook when a Quiz is completed in LearnDash using WordPress than you can do it in the following way.

 add_action("learndash_quiz_completed", function($data) {
//Called when quiz is completed
}, 5, 1);

You can adjust the priority of the function as per your need.  

WordPress LearnDash Topic Completion Hook

If you want to call a hook when a Topic is completed in LearnDash using WordPress than you can do it in the following way.

 add_action("learndash_topic_completed", function($data) {
//Called when topic is completed
}, 5, 1);

You can adjust the priority of the function as per your need.

WordPress LearnDash Lesson Completion Hook

If you want to call a hook when a Lesson is completed in LearnDash using WordPress than you can do it in the following way.

 add_action("learndash_lesson_completed", function($data) {
//Called when lesson is completed
}, 5, 1);

You can adjust the priority of the function as per your need.

WordPress LearnDash Course Completion Hook

If you want to call a hook when a course is completed in LearnDash using WordPress than you can do it in the following way.

 add_action("learndash_course_completed", function($data) {
//Called when course is completed
}, 5, 1);

You can adjust the priority of the function as per your need.

Tuesday, September 27, 2016

Delete all tables from database using command line

We can drop all tables of a database using an GUI Interface like PHPMYADMIN. But sometimes in some scenarios we do not have access to the GUI Interface like PHPMYADMIN but only tool like command line or command prompt.

In Such scenarios we can drop all the tables of a specific database using the command line. Following are the statements which can be used on the command line to drop all the database tables from the database with ease.

SET FOREIGN_KEY_CHECKS = 0; 

SET @tables = NULL;
SELECT GROUP_CONCAT(table_schema, '.', table_name) INTO @tables
  FROM information_schema.tables 
  WHERE table_schema = 'database_name'; -- specify DB name here.

SET @tables = CONCAT('DROP TABLE ', @tables);
PREPARE stmt FROM @tables;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET FOREIGN_KEY_CHECKS = 1;

That's it all tables from the database will be deleted.

MS SQL : How to identify fragmentation in your indexes?

Almost all of us know what fragmentation in SQL indexes are and how it can affect the performance. For those who are new Index fragmentation...