Basic Searching Using PhpMyAdmin

PhpMyAdmin is a useful web-based tool which allows you to perform a range of database actions, typically on a MySQL database. Although it can be a bit clunky, it is nonetheless powerful and it’s one of those features that I want to talk about today: searching. This isn’t an exhaustive list of the myriad ways you can hunt for things in your database; it’s a simple couple of examples, but hopefully it will be specifically useful if you are searching for more than one possible item in a field. OK, let’s get nosey!

Firstly, once logged into the admin console and having clicked on a database and table on the left (let’s hope you can get that far), click on the search tab at the top.

I can’t access your database (of course!) so from here on in, we’re going to be using mine, but you can easily adapt things. We’re going to begin by searching one field. Here I’ve clicked onto the empty box alongside my “first_name” field, and typed “Stephen” (without the quotes).

Somewhere down the bottom right of the window (you may have to scroll down), you will find the “Go” button - that’s what you click on to make the search start. When I do that, I get these results:

Easy, right? Just by typing in the thing you are looking for, you can search that field for that (exact) item. What if we want to filter based on more than one field?

Searching for more than one (different) item in multiple fields

To base your criteria on two fields, just type in two values in the specific two places. I am keeping things simple and using the “last_name” field, too.

Again, click on “Go” to make the search occur.

Searching based on partial information

How about a situation in which I think I know what I want, but I am not quite sure how it begins or ends? For that, you can search using the “% LIKE %” comparator. You can find that by accessing the drop down where you see “LIKE”, so let’s choose that.

In this example, I am sure the name I am looking for contains the string “tephe” but I can’t remember the beginning or end (don’t laugh - you will be as old as me one day!). Again, I click “Go” and magically, my results re-appear.

Searching for more than one item in one field

That’s all pretty obvious but what if I want to search for two (or more) things, in one field? For instance, I might be searching for “Stephen” OR “Steven” in case the name is spelt differently. For this, we’re going to use what’s known as a regular expression and in particular, the pipe (“|”) symbol. It’s the one you get when you usually press shift-\ on your keyboard. As shown, just type your two (or more options) separated by the pipe symbol and press “Go”.

There’s much, much more you can do with this (especially with regular expressions) but hopefully this will get you started.

Hi! Did you find this useful or interesting? I have an email list coming soon, but in the meantime, if you ready anything you fancy chatting about, I would love to hear from you. You can contact me here or at stephen ‘at’