Website Performance - We can Help - Merkados
Website Design Promo

Replacing a Character in a MySQL table using REPLACE

November 24th, 2019 admin

The latest replacement I had to do was to change all occurrences of an apostrophe with a single quote in a table. Now, that wouldn’t be a lot of fun to do by hand and believe me, with the number of records it would also be exhausting! So, this is a very quick post that shows you how to update a table, using the REPLACE function in MySQL to change one character:

1. First go ahead and find out how many records are going to be affected:

SELECT * FROM table1 WHERE column1 LIKE "%\'%";

2. Once you know the number of records then simply run the update routine:

UPDATE table1 SET column1 = REPLACE(column1, "\’", "\'") 
WHERE column1 LIKE "%\’%"

That’s it – very simple. We are updating the table1 and setting the column1 to be equal to the result of a replace. The replace function takes three parameters: 1. The column, 2. The replacement pattern (in this case escaped by a backslash), and 3. The character to replace with – in this case, also escaped with backslash.

The result is a fine looking column of data with your new characters…


Setup a Git Repository in your VPS

November 6th, 2016 admin

When I was new to the whole version control scene, I wanted to jump in the wagon with both feet and really start using GIT. The problem was that it is not as easy as people make it sound. I was confused with figuring out what a repository meant, what pushing, clone and all sorts of problems that a beginner may have. And the problem is that the documentation available was also a bit technical and difficult to read. That’s why I wanted to explain it here. Now, my personal challenge was that since I have access to a VPS via SSH, I didn’t want to necessarily pay for a private repository if I didn’t have to. And since I was beginning to use git, I really didn’t need a great account with Github or something along those lines.

The other challenge is that I wanted my repository to be available everywhere but also to be private to me. I wanted to be the only one to access it. The reason is that sometimes I am out of the country, and I would love to be able to simplify the process of working remotely in projects and keeping them on a VPS repository.

Read the rest of this entry »

Hook_views_api – Use custom db table in Drupal Views – Tutorial

October 19th, 2012 admin

Ok so perhaps you have been in a position where you are developing a specific set of functions for a client in Drupal and you are leaning towards displaying some specific information from the database. It could be in a block or it could be in a page. This information would be displayed perfectly by Views (Drupal module) however you are creating a custom table in your Drupal database and of course Views doesn’t know about it.

You may think that since you are doing custom tables, why not simply bypass Views altogether and create a custom query as well. However, you understand that Views gives you great functionality out of the box like a pager, different display options (blocks, attachments, pages, and sometimes even CSV and more). So you decide that you need to learn how to modify the SQL query. Believe me, you could do that, but it would be a long night. So instead of attempting to change the query directly (which sometimes is inevitable) I am going to share with you how to “present” or “introduce” or “let Views know about” your new custom table so that you can use it for relationships within the GUI.

First let me say that you could do this by utilizing the Data Module. However, you have to enable the Schema Module as well and believe me when it comes to database modules, less is better.

Read the rest of this entry »

Using Apache .htaccess file to remove Query Strings

July 31st, 2012 admin

So today’s post is a little bit more technical than usual. But I’m sure that some of our technical readers will get a lot of value out of it.
In the world of SEO everybody is trying to move ahead, gain an advantage. Because of this fact, sometimes some webmasters are willing to take positions that are unethical. Sometimes they manipulate their own websites to get an advantage. However, sometimes they manipulate other people’s websites to take advantage as well. Read the rest of this entry »

How to Setup Virtual Hosts, MAMP – Mac OS X

September 20th, 2011 admin


So let’s say that you want to be able to work locally setting up a website instead of having to make all the changes in a remote server. This is often the case with beginner website developers. We’ve all been there so don’t feel bad. The usual thing is that you more of less develop the site and now you are pushing it live via a FTP client. But all of a sudden you want to change something and now you see yourself in this sea of downloads and uploads and it is certainly not working anymore. Plus, there is definitely a faster way right? You are right my friend, there is.

Read the rest of this entry »

Applying Patches in Drupal on your Mac via Terminal

August 11th, 2011 admin


Quick little tutorial here. Let’s get to it. Let’s say that you have a Drupal website running in your web server in your Mac -for example with MAMP. And lets say that you have installed a couple of contributed modules manually or through Drush. However, the module developer found a bug and fixed and instead of updating the module itself, they decided to issue a patch for you to apply.
Now you may ask, that is great stuff, but how do I install the patch for that particular module? Don’t worry it is simpler than you may think. Read the rest of this entry »

DrupalCon Chicago

March 9th, 2011 admin

Hello everybody. So Tuesday has been the first day of DrupalCon Chicago and lots of great things happening around the Drupal community. First, Dries Buytaert, project lead of Drupal, gave his keynote and talked basically about the future of Drupal, an overview of Drupal 8 and of course the philosophy behind it. I think that he is in the right path on his assumptions of media consumption and how people are using mobile devices increasingly. Read the rest of this entry »

Referencing to the file used in the field is not allowed.

June 9th, 2010 admin

If you are using Drupal’s Insert Module, you may come across a very interesting problem. You may insert new images into your posts (inline), however, when you are ready to edit nodes you are welcomed with a message that says: “Referencing to the file used in the field is not allowed.” What do you do then? Read the rest of this entry »