MySQL Code for adding days, time to date column

Use following code to update a date column in MySQL table. One can add days, hours and more depending on the requirement. A fix date can be provided (like 2023-06-20) to which days can be added, current date can be used to add days, existing date_column value can also be used to add days, based on other column value like serial number or some number can be added.

using fix date

UPDATE table_name SET date_column= ‘2023-06-20’ + INTERVAL 2 DAY + INTERVAL 19 HOUR;

using current date

UPDATE table_name SET date_column=CURDATE() + INTERVAL 2 DAY + INTERVAL 19 HOUR;

using column date

UPDATE table_name SET date_column= date_column + INTERVAL 2 DAY + INTERVAL 19 HOUR;

using column value

UPDATE table_name SET date_column= ‘2023-06-20’ + INTERVAL column_name DAY + INTERVAL 19 HOUR;

Online Shopping e-commerce implementation logic with coupons

Online shopping is gaining boom. More web companies/stores (webpanies) are opening up. Big companies/market place have coupons system and online payment system. Small, medium and large businesses are also coming online to sell products. They need a shopping cart mechanism along with payment system. Many CMS are available for integration with website along with payment … Read more

PHP bidirectional algorithm to find connection between linked users

This is the version (2.0) of our earlier post Find connection path between two users in a social network using PHP and http://blog.kunals.com/php-code-find-2-users-connected-friends-social-network/. In this version bidirectional search is performed from both ends/nodes/users and if found path is displayed. This is based on graph traversal, breadth first search (bfs), bi-directional bfs. Nodes are the users and … Read more

PHP code to find how 2 users are connected through friends in social network

This is the second version of our earlier post Find connection path between two users in a social network using PHP. In this version performance issues have been taken care upto some level along with minor tweaks to code to make it more efficient. Initialising start user, end user, maximum level/degree/depth [php] $user_from=1; //start user … Read more

Find connection path between two users in a social network using PHP

Social networking sites are coming up daily. Users are linked to other users based on various factors like friends, interests, groups, same school, same company, same locality and many more. In all these we are connected to people we know or upto next level that is friends of friends. A need has been identified to … Read more

Captcha PHP Script

About (in brief) It does not require images but works on text. Now you can protect your pages with the use of Captcha, you can now have some additional security/authetication/nospam to your web pages. Description An easy to implement Captcha Script which does not require images but works on text. Now you can protect your … Read more

Block Words PHP Script

About (in brief) Restrict certain words from being used at any place while registration, form filling and many other areas. It can be used at the places where you want to restrict the use of certain words like that of organisation related, admin related etc. Description Stop Vulgarity or Block Words is a PHP script … Read more

Affiliate Referral PHP Script

About (in brief) The user after login can send invitations his/her friends, only a limited number of invitations can be send daily by the user depending on the maximum number of invitations set by you (default is 10). Description User after login can send invitations to his/her friends, only a limited number of invitations can … Read more

KB Free PHP Scripts

KB PHP Scripts offers you easy to use and implement Free PHP Scripts for download! Here, you can download various easy to use scripts. Also, you can rate and review these free scripts here. Though these scripts are Free but I may provide support for them, if I get some free time. Please feel free … Read more