News & Blog

New Website Launched to Find Attractions Between Two Places

November 12th, 2012 - Posted by Steve Marks to (X)HTML / CSS, Javascript / jQuery, MySQL, PHP, SEO, Web Development.
For regular readers of this blog you might have guessed that I’m a huge fan of maps, and working inparticular with the Google Maps API. I also find that the best way to learn anything in the coding world is to use it in a real life scenario. As a result, and to hopefully produce [......

MySQL BETWEEN Two Negative Numbers Returning No Results

November 8th, 2012 - Posted by Steve Marks to MySQL, Web Development.
When recently working on an application that contained a map, I wanted to get all items from a MySQL database between two latitude/longitude coordinates. As a result my initial queries looked similar to the below: SELECT `fieldNames` FROM `my_table` WHERE `latitude` BETWEEN 42.689506 AND 4...

How to Order GROUP_CONCAT() Values in MySQL

September 1st, 2012 - Posted by Steve Marks to MySQL, Web Development.
When performing a GROUP_CONCAT() in a MySQL query you might notice that the results come back in no particular order, or to be precise, in the same order as if you ran the query without the GROUP_CONCAT(). Let’s take the following SQL to create our test scenario: CREATE TABLE `animal...

MySQL Error Resolved – Subquery Returns More Than 1 Row

July 26th, 2012 - Posted by Steve Marks to MySQL, Web Development.
If you’ve found this post you’re probably trying to find out why your MySQL query is returning the following error: Subquery returns more than 1 row To allow me to explain the problem let me show you an example of a query that might throw this kind of error: SELECT `col1` FROM ...

Ordering By Multiple Columns in an SQL Query

July 26th, 2012 - Posted by Steve Marks to MySQL, Web Development.
I remember when I started coding and writing SQL, one of the very first things I had to look up was how to order an SQL resultset by multiple columns. Let me dive right in and provide some examples… Ordering by a single column SELECT `col1` FROM `tablename` ORDER BY `col1` Ordering b...

MySQL ‘Column X cannot be null’ When Performing UNION ALL

July 18th, 2012 - Posted by Steve Marks to MySQL, Web Development.
Whilst recently trying to run a query that involved a UNION ALL, I got an error claiming that a column could not be NULL. Running each of the queries individually worked fine so I knew I had to dig a bit deeper. Here’s a simplified version of my query: SELECT `amount1` AS amount FROM...

MySQL DELETE Query Statement With JOIN

December 3rd, 2011 - Posted by Steve Marks to MySQL, Web Development.
Executing a MySQL DELETE query that contains a JOIN… This is something that I always forget how to do so I wanted to write about it as a personal reference, and to help others looking to do the same. First lets take a look at a standard DELETE query containing a single table: DELETE ...

Plesk Container Not Accessible After Deleting Admin MySQL User

September 28th, 2011 - Posted by Steve Marks to MySQL, Server Management, Web Development.
Whilst recently carrying out a security audit, one of the tasks on my list was to refine the permissions that MySQL users have. One of the users in the list was called ‘admin’. It had full permissions to all databases which struck me as a bit unsafe so, seeing as I wasn’t...

Step-By-Step Guide to Putting a WordPress Site Live

July 25th, 2011 - Posted by Steve Marks to MySQL, PHP, Web Development.
Putting a website live normally involves transferring files from a development area into a live webspace and, depending on the site, moving a database too. The process is essentially the same when putting a WordPress site live but there are a few additional steps required to get fully up a...

Switch Case Conditional Statement with MySQL

July 17th, 2011 - Posted by Steve Marks to MySQL, Web Development.
When selecting fields in a MySQL statement you can perform certain conditional statements to get the values you require based on other values. One of these is the Switch Case conditional statement. If you’re familiar with other programming languages you probably know how to do this a...