Jonnie Grieve Digital Media: Website Blog.

Archived Posts: October 2016 – Jonnie Grieve Digital Media posts.

Websites and interacting with databases.

So in recent weeks my learning attention has switched from Java to PHP.

When I was doing my HNC (Higher National Certificate), a couple of years before I started my degree I was faced with a challenging individual project. It was a very difficult time and a crossroads in my academic life. I faced failure and learning how to pick myself up again. The project I spoke of involved learning how to connect a website to a database.

During my project. I had a project tutor. Every week he would ask me about something called a “confidence test” which was a very particular particular process referring to making a successful connection to a database.  I did try but I could never manage it. And it transpired I was trying to do something I had no experience in doing from my course.

In the project I ended up doing have to attempt in the end and bizarrely, it was the only module I ended up passing in my HNC but I failed that year. I had to take that hit and try again the next year.

Fast forward nearly a decade and I did pass my HNC in the end; I did go on to get a Higher National Diploma; I did get my degree.  And I have gone onto tackle database connections again. This time I have made successful connections and my “confidence” in that regard has increased.

I am now learning how to create webpages that interact with databases in different ways. creating records, reading data, updating those records and deleting them. In other words all the basic interactions with data that fall under the term CRUD. Create, Read, Update, Delete.

Today, with a bit of painstaking research I solved a major problem that was holding my back in a small personal development project.

I was so sure that I was following the video tutorial to the letter but there was just one or 2 little differences in my code that caused the bugs.

Imagine a simple web page with a drop down box, which is a form element and a button that is going to bring up a report based on data that lives in a database.  There was a problem in that no data was being return but I kept getting this PHP notice on the page.

So somewhere along the line not all the data, (or none of the data at all was being retrieved and passed to the function. Eventually I traced the issue to 2 small typos.

The first thing was I needed include the colon in my first echo string for the option value. I’m not sure what makes that work but I think it’s something to do with the query string. Not having it meant a property wasn’t carried over causing the offset warning.


So now when I tested the form I was getting this query string in the URL.

But having solved one problem, it seemed report wasn’t generating any tasks or totals when I tested the drop down. With a keen eye, I noticed that the query string wasn’t carrying a last number in the URL; the number identifying an individual record which is a project ID.

I traced the problem to the same function. One of the things about working with soft and hard quotes is knowing when to use them and in what combination. It seems like I trying to apply a hard quote into the reference to the project ID even though this was concatenated in.

So another day passed and a new learning experience. Now, database connections aren’t such a mystery and are not so daunting. Hopefully I’m going to learn a few more things about CRUD too.

New project: Object Oriented PHP

I uploaded a new project to my portfolio earlier today. This is a project I’ve been working on for a little while in my attempts to get to grips with Object Oriented Programming in PHP.

I followed a Treehouse course which teaches how to use Objects in PHP create an online Cookbook. As I built the file I saw the potential to branch out the work into a set of web pages.

  • Homepage
  • Cookbook
  • Meal Plan
  • Shopping List
  • And a request page to include more recipes.

Rather than hard coding the content in HTML it is stored in PHP files, included into the project via PHP and generated once in a special PHP file across many pages.

Say for example I want to look at the required shopping list all for the recipes in the cookbook.

By simply going into shoppinglist.php I can see how this is rendered.

echo Render::listShopping($cookbook->getCombinedIngredients() );

FirstRender class from render in which the listShopping method is contained. The instances of another class through the cookbook variable which then calls the method from the RecipeCollection class.

The three main files that make up the process are

recipes.php – the files that create Objects that store the raw data that contains the information for the recipes.

render.php – contains a separate php class that contains methods for displaying recipe data to the browser.

recipe-collection – the getter and setter methods that retrieve methods and set values so they can later be run.

Much of what I have done remains a blur. I’ve never hidden the fact that I don’t have a natural programming brain. But I do think I’ve stood myself in good stead by spending time building this project. I’ve organised it in such as way as the flow of the program is easily traceable.

Dyspraxia and its barriers to learning

I was having a conversation with someone earlier today about coding and it triggered some thoughts in my mind that I’d like to express while they’re fresh.

I don’t doubt that coding, website design and IT is the work area I’m most suited too. I’ve always been most comfortable working with computers.

The thing about computers is they’re only as good as the instructions or the information they’ve been given. They will not work for themselves. They need to be given input.

The human brain is a different thing. I’ve often seen it referred to as the most advanced computer there is. And I think its true. It can process information and instructions but it can also think for itself. It’s aware of things in a way no computer I’ve ever known is.

Then, there’s my brain.

I spend a lot of time working on websites like Treehouse to try to keep up with my degree. I love to keep learning and try new things in the world of tech.

And I like to do this because… I HAVE to.

With my Dyspraxia I don’t just struggle with organisation of movement; I’m not just a little bit clumsy. I struggle with organising my thoughts and planning ahead. I can very easily forget things I’ve learned because it’s being properly stored in my memory.

For instance, I’ve been trying to learn about the all-purpose programming language known as Java. Java is everywhere, not just in the world of web development.

This is not just a case of not understanding the concepts I am learning. If I don’t understand something I keep going until I do.

Even if I’m getting it, tomorrow is a another day and I realise that I’m not yet ready to apply the new-found knowledge because by then it is highly likely that knowledge has already gone.

It might be a confidence issue. It might be an issue that my brain simply cannot get round complex tasks. So either way, I keep going. I keep learning new things in the hope that one day it will just click.  If I can’t do it, then at least I know what’s out there and I comfort myself I’ve at least introduced myself to new concepts.

I’ve been doing this for nearly 3 years now and studying tech for longer than that and it is the same process in my mind.

  1. I set my sights on a new learning goal.
  2. I start learning, note taking on the most important points, and I maybe build an example for my portfolio
  3. By the time its done I have moved on to something else and there’s no more room for the information I’ve previously been trying to learn.

Can you imagine how frustrating this is? My brain once to be a brainbox. It wants to learn and to learn NOW. But doesn’t know why it can’t quite get there.

But it isn’t always like this. The last time all my learning and development bore some real fruit was when I looked into developing WordPress websites.

I haven’t by any means learned everything but I have made giant strides. I’m comfortable my way around the back-end of WordPress, making basic themes and managed to gain lots of work with Websites that use the system.

I would never have been able to do this so confidently if it wasn’t for the time and effort I put in to learning these things.

And I’ll keep doing it. It is always good to learn new things and to chase a dream. Dyspraxia might be a barrier but barriers can be overcome.