Relation tables in MySQL

If we are using more than one table in database, we need to make sure that they have relationship with each other.
I decided to do it with ‘ID’ which means that all my tables that I want to use have to have ‘ID’ and Category_ID in as you can see on the pictures belove –

Untitled4

Untitled

Untitled2

Untitled3

The big mistake I made earlier when I tried to create CMS and it wasn’t working properly was that I didn’t know about relational tables and I put different ID names in each table. Please click here┬áto read my post about it.

 

CMS – fixed!

In my previous post I was talking about CMS that was not working. Problem is solved!

What was the problem

The problem was in function Untitled

In my code, there was capital ‘ID’ which is old way of doing it and that is why it was not working. The reason why I had capital ID there was in my tables and I thought everywhere it had to be capital.

Function is always with lowercase ‘id’!

CMS – edit option not working

I created CMS where users can log in, see all posts, add/delete posts, create categories, and also edit posts.

All of them works perfectly fine apart from edit posts option. I, lecturer and a few friends spent so many hours trying to figure out why it is not working but the final result is to start building it from the beginning as no mistake was found but it is still not working. Possibility might be corrupted files as I made massive and dragged files around and that way full website can fall apart! NEVER NEVER NEVER DRAG FILES FROM LOCAL TO REMOTE!!!!

What it is doing

When you point with cursor on ‘edit’, you can see that id is called from table and also after clicking on ‘edit’, URL shows the right id from table but text is not pulled out so we end up with empty form.

Untitled

 

Next step

My next step is to start building CMS all over again.

CMS (content management system)

One of requirements for this project is to have CMS in the website so users (only users with username and password!) can manage content of the site.

Untitled

I decided to put this option to the footer as it is important only for the right users and it is not in the way of design.

THERE IS NO CSS ADDED TO CMS YET! AS I WANTED TO MAKE SURE IT WORKS FIRST!!!

After clicking on ‘ADMIN‘ users will get new window asking them to sign in –

Untitled

Untitled2

 

After logging in

Users will get this choice of how to manage content of the website –
Untitled

User will be able to view all current posts by clicking on ‘home’ –
Untitled

Add post –

Untitled

After clicking on ‘Add’, they will be able to see recently added post straight away like this in ‘manage posts’ –

Untitled

Choice of editing or deleting is under posts and gives users easy manageable option to use CMS.

Delete option is secured with pop out window asking users if they are sure they want to delete this post. This option is provided to avoid users deleting posts accidentally –

Untitled