MySQL update if value is greater than current value

While working with MySQL database there might be situation when you wish to update certain column only if the value being updated is greater than existing value or current value stored in that column. MySQL GREATEST and LEAST functions are quite handy in such situations. Let’s see how can we use first function to update a column if value is greater than current value.

Read More

Get query string parameters values from URL in JavaScript

Sometimes we need to retrieve URL parameters values from browser address bar in our client side script to process some functioning like click to a button or show/hide some elements. Here I have created a function in JavaScript to get query string parameters from URL and displayed uses example.

Read More

PHP make directory or create year months folders

Like in a WordPress website, photos added in posts inside dashboard post editor are kept in dynamically generated year months directories inside wp-content/uploads directory by default. This blog will assist you to make directory in PHP and we will then create year months folders at our server.

Read More

3 functions to check if string contains specific words

check for existence of a substring into a string is a common requirement for programmers. Here I’m describing 3 functions to check if string contains specific words.
  • strpos¬†–¬†Find the position of the first occurrence of a substring in a string.
  • strstr – Find the first occurrence of a string
  • preg_match – Perform a regular expression match

Read More

Keep checkbox checked after form submit in Codeigniter

The set_value(‘field name’) function in codeigniter allows us to retain the value of input field in form during form submission but it’s not applicable to keep checkbox checked if it was checked while the form was submitted or during postback submit refresh. Here to keep checkbox checked after form submit in Codeigniter, the set_checkbox() function plays the role.

Read More

How to check if a page exists by url?

There may be a situation when you need to display content based on existence of a page or custom post by url. As the example below there are two different parent pages for the same page slug. We assume that certain pages will have the same title, and just have different parent pages. So we want to check if a page exists by url?

Read More

getting timestamp in JavaScript

I am describing here getting timestamp in JavaScript. In development,so many times we do the date and time manipulation and If we need to do it client side means we need to use JavaScript.

Read More

Number of days in a month

PHP provides functions to get the number of days in a month for a specified year and calendar. We can use date(‘t’) or cal_days_in_month. See syntax, parameters and examples in rest of the article.

Read More

Use functions.php to create child theme in WordPress

The old way to create child theme in WordPress is to place a style.css file in your child theme folder and import the parent stylesheet into the child theme. But WordPress documentation stated the use functions.php to create child theme in WordPress and use wp_enqueue_style() to enqueue the parent stylesheet.

Read More

[ Page 1 of 2 ]