Call to a member function … on a non-object

This error usually means that either your code is expecting a variable that isn’t there (so for instance your database needs populating) or your code has assigned the variable in such a way that it can’t be picked up correctly.

You can’t simply ‘echo’ the object variable to see what has been assigned however by using echo in combination with print_r you can view both the variables that your code is expecting as well as those that are actually assigned.


echo print_r($object);

Replace $object with the name of the object in question.


How do I import a large mysql databse file?

If you are importing a file over a few MB more often than not the phpadmin interface will crash.

Depending on the size of the file it is possible to simply break it into chunks and paste each section into the sql window but this very quickly becomes tiresome and also could lead to missing out data.

A much more effective way of doing this is via your command prompt and only takes a few moments (where I write something in [ ] brackets the contents of the brackets needs to be changed to your local values and the brackets omitted):

  1. Open your command prompt and navigate to your mysql/bin directory (entering cd .. takes you up a level, entering cd [name of directory] will change you directory to the name entered).
  2. Login to mysql – type: mysql -u[username] -p then press Enter. Enter your password when prompted. The command prompt should now look like : mysql>
  3. Assuming you have already created the database, type : use ‘[database name]’
  4. Type source [path of file to import].sql (so for example this could be source c:\Users\Someuser\Downloads\myfile.sql or similar)
  5. The command window should then show files being imported row by row.

As I type I am in the process of importing a 586 mb sql file, so far so good..


How can I update a WordPress password directly in the database?

I have found it useful at times to be able to simply change a password directly in the database, here’s the MySQL query to do it:

UPDATE wp_users SET user_pass = MD5(‘THE_PASSWORD’) WHERE wp_users.user_login =’THE_USERNAME’ LIMIT 1;



Local Business Accelerator – HSBA

We (the Homeworking & Small Business Alliance) recently entered the Local Business Accelerator competition – and were really pleased to be nominated as one of three local winners in the Market Harborough area.

The award means that the HSBA will receive three months worth of free advertising in the local newspaper, the Harborough & Lutterworth Mail (circulation 40,000) as well as mentoring from a panel of local business leaders.

It has been a month since we started and we’ve been busy!

The advertising was a learning curve as we started with an idea which has gradually been honed thanks to the input of Alastair Campbell (The Ideal Marketing Company) and Brian Dodds (the Harborough Mail).

We are pleased with the outcome and have been seeing real results as a result of the ads, with people contacting us and booking to attend HSBA networking events. We now have two more months left so hope that the final versions will have give the groups a real boost.

We also met up with James Briggs, Chairman of the Harboro Rubber Co, one of the most established businesses in the area, to go over our business plan. We had some very positive feedback and are looking forward to making the business plan into a reality.

We have yet to meet up with our final mentor, Matin Hill of solicitors Bray & Bray who will be giving us advice on legal matters.

At the end of the three months the mentors will be voting for one of the three regional winners to be put forward to the national level – we’ll be working hard to ensure that the HSBA is a serious contendor for this next stage, it has been a very positive experience so far.


How to stop SQL injection attacks

If you have a website which is powered by a database it is potentially vulnerable to SQL injection attacks – this is relatively simple to protect against and the risks of not doing so are to compromise the integrity of the data stored on your server and possibly the website itself.

What is an SQL Injection attack?

Most websites will pass data from one page to another in order to maintain continuity. For example you might be looking at a list of products and you click on a particular product for more information. The website will pass the ID of the product in question to the next page so that it know what informationt o serve to the customer.

In many cases this is passed in the URL, so you might have  something like

An SQL Injection attack occurs when the recipient page takes the XYZ in the URL and makes a query with the database without verifying first that it doesn’t contain any additional and unexpected nasties.

How do I stop Injection attacks?

The key is that every time you retrieve a variable which you intend on passing to the database, check that it is in the expected format. Usually a product ID would be numeric, and not include any other characters. A date might be in the dd/mm/yyyy format. Once you have predetermined what format you expect each variable to be in, create a rule to check it prior to submitting it to the database – and if it fails stop the process.

I know what format I expect it to be in, but how do I check it?

The PHP code preg_match is probably the best method as it allows you very specific controls.

The following would check the variable $input for a date in the format yyyy-mm-dd. If there are any other characters, the page would be redirected to a page where no database queries are made, so stopping the threat.

if (!preg_match(‘/^[\-+]?[0-9]*\-?[0-9]*\-?[0-9]+$/’, $input)) {

The following test just allows numeric characters, any number of them, but anything else kicks it out:

if (!preg_match(‘/^[\-+]?[0-9]+$/’, $input))

You can also allow alphabetical characters, in the following case any character in either upper or lower case:

if (!preg_match(‘/^[\-+]?[a-zA-Z]*+$/’, $input))

There are plenty of guides on the Internet about how to use preg-match()

Simplify the process

You will probably find that you use one or two formats a lot, so create a function where you pass the variable and the type of format expected, then each time you retrieve a variable run it through your function to verify it is of the expected format.





Networking groups

Last year I became involved with the Homeworking Alliance, a networking group for homeworkers.

At the time it had only recently been founded and was being run on a voluntary basis by Jane Giffard-Tiney. It’s now  been put on a more professional footing and is expanding, with groups in Lutterworth, Kettering and I think Leicester all pending.

Within Market Harborough there are A LOT of networking groups, but the majority of them suffer from the same obstacles to me joining – the first and biggest is that they meet for breakfast once a week or every other week from 7-9 am. As I’m responsible for the getting the kids off to school and nursery that is a non-starter.

They also invariably insist on only one person per industry joining, so they’ll have one accountant, one lawyer etc etc. The idea is that all members are constantly on the lookout for referals for other members of the group and they don’t want any conflict of interest.

From a business perspective I can see this being potentially rewarding – you turn up to a meeting of 10-15 people and each of them is supposed to give you a business lead each week (although you have to return the favour), so I would consider doing it if I could, but personally I think it is short-sighted – I am not sure that I would be able to provide leads for all those other members each and every week so likewise you have to question whether the quality of leads received would be any good; in addition I would prefer to compete with other companies on an equal footing,  if there is another company doing what I do and they can offer a better or cheaper service to a customer then good luck to them.

Besides the Homeworking Alliance I am also a member of the Market Harborough Chamber of Commerce, (which tends to meet 7-9 pm) which is also very good. Both groups are informal and friendly and both have provided me with business leads.


auto-responder – the saga continues!


I set up my autoresponder as per previous posts, everything worked a charm until… my email client decided to start downloading all previously downloaded emails – it didn’t actually get that far as two days later it was still calculating the size of the download.

Either way, I had two days worth of emails not downloaded and therefore not responded to. There must be a more foolproof system than this?!

Other than that, the everything else worked a charm..


Groundwire softphone

We went to Marrakech in Morocco during half term – I was on call and had checked with 02 prior to leaving that my phone would work, which apparently it would albeit at a cost: 81p a minute to call the UK and 50 something pence a minute to receive calls.

The plan however was to use Groundwire, which is a ‘softphone’, i.e. a software based phone using Voice Over IP to make and receive calls, rather than using the 02 network. You need a VOIP account to use groundwire and I was using my  Globe2 account – this costs just 1.5p a minute to make calls and nothing to receive.

Once in Marrakech I was very pleased to have this functionality, not just because of the cost but because I had zero signal the entire time I was there! In hindsight I think if I’d rebooted my phone it might have connected.

The only issue then was accessing the Internet, as Maarrakech isn’t the most digital place you’ve ever been to. Initially we managed to find an Internet cafe with an unsecure wifi connection, so we stood in the street (which was very noisy with motorbikes, donkeys, cyclists, pedestrians and cars all trying to squeeze through a narrow single lane space) but eventually found out that if we stood in a specific spot in our Riad (hotel) we could get a connection in piece and quiet – and like this it worked a charm, I had a few issues I had to deal with but still managed to enjoy my time away.

Groundwire is for the iPhone and is OK, the call quality was absolutely fine but I find it a bit clunky receiving calls. Jo’s Blackberry uses a different softphone which seems a lot more intuitive, I’ll be posting a review on this soon on Globe2 (along with a new site soon!)


new-look twitter

Is it me or is this not working?
I tried it in both Firefox and IE but all I get is a header bar with a blank page. IE brings up page errors:


auto-responder update

This is the first time I’ve had to set my auto-responder since last time, the biggest problem I see is how not to get stuck in the auto-responder loop.

I’ve been through the emails I get and have a more comprehensive list of generic emails not to reply to:

  • no-reply
  • noreply
  • do-not-reply
  • my own domain name
  • news
  • money
  • mailing
  • linkedin
  • amazon
  • notification
  • service
  • newsletter
  • auto
  • support
  • webmaster
  • publish
  • contact
  • customer
  • purchase
  • welcome
  • security
  • magazine

You may also need to add in specific companies – I’ve got amazon and linkedin in my list above – which are relevant to you.

The idea is that I have a message rule above my autoresponder which says ‘if I receive an email which includes any of the following in the Sender field, stop processing more rules’. Then if I get a newsletter from someone I don’t auto-respond to it, they don’t respond to my autoresponse, etc.

I’ll let you know if I have any more luck with my ammended rules!