Database and Logical Issues

HamisHamis Posts: 8
edited May 2019 in Python

Hello guys! I have been learning PHP for a while now and things are starting to get messy as I progress day by day. I am currently facing what I may term 'creativity block'. 

I am working on a project, a website/forum that allows people to register and post on various topics. I don't know how to echo posts individually from the database. I also don't know how to make a topic's title the link to the page that shows the topic's post.

Please, guys, I am not asking for the code to solve these problems. Let me learn the code myself, all I am asking for is the logic/how to do from your experience(s) as programmers.

I have attached shots of the webpage for your perusal.

Thanks and long live A/C!!!


  • drocksofangelodrocksofangelo Posts: 38
    edited April 2019

    If you are doing with with "vanilla" PHP; then you would run into issues pretty quickly and you will produce lots of spaghetti code.

    You should learn php itself first; then learn a framework. A framework was designed to make stuffs like this easier.

    Remember that a topic can have many posts and a post can only belong to one particular topic.

    So you will need to create a relationship like this:

    topic -> hasMany('post');

    post -> belongsTo{'topic')

    'topic' and 'post' would be entities in your database. the post would have a foreign key of topic (f you choose). And you will need mutiple models e.g. topic, post, user etc because a user can create a topc and post inside it or post inside another user's topic;

    well you get the idea.

    So go back and read about relationships in PHP . . you can do it with pure php but a framework will ensure you live long

    enough to see your projects go live. (no pun intended)

Sign In or Register to comment.