Organize PHP/MySQL Ideas HELP

8 replies
Hi,

I am new on PHP and MySql after practicing a lot I decided to do a complete website using the language, I already have a new idea but I have a problem to organize it, I also don't know how to start because is my first complete website.

So if anyone could help me it would be of much help,

I would like to know how should I start with the organization, should I start writing the structure of the database? what should I write? what to think? where to start?

I am very confuse so it would be helpful if you can help me clear my mind....

Thanks
#ideas #organize #php or mysql
  • Profile picture of the author andreasnrb
    Do a search for PHP and MVC.
    MVC is a way to structure code and html files.
    Signature
    Excellent product, Excellent support, great for affiliate marketers (Amazon, ClickBank etc)
    http://andreasnurbo.com
    {{ DiscussionBoard.errors[4425784].message }}
    • Profile picture of the author Speedyapoc
      I always like to establish what I am specifically using the database for. Think, what are you going to be changing? What is going to be dynamic? If you are wanting to have multiple articles, or dynamic content on one file, I would think that that would be a good reason to use a database. However, if you have static content, hard coding into the PHP or HTML file is not looked down upon.
      {{ DiscussionBoard.errors[4425857].message }}
  • Profile picture of the author Workman
    I agree with the MVC model of organizing your logic and file structure. Symfony.com actually has a nice introduction into MVC by comparing it to a rudimentary site built in PHP.

    It has been the best explanation I've come across on why MVC is a solid organization model and why developers who work in a team environment love it.

    As far as your database, think major features. If there is going to be a blog, users, contacts, products, etc and go from there. Consider what you could break down from there and how they are related -- like blog categories, product attributes, user uploads.

    Also consider things that could have multiple relationships, like contact addresses -- two contacts could share the same address. So you could create a relationship table that links their two ids to each other.
    {{ DiscussionBoard.errors[4432416].message }}
  • Profile picture of the author Harrison_Uhl
    Your use of php suggests a 'dynamic' website, which is essentially a (form of a) computer program.

    The first question in developing a computer program is always: What are all of the things you want it to do (i.e. what results should it produce?) The second question is: What inputs are available (and needed) to produce these results?

    Next is the question of mapping out the path to transform the inputs into the desired results. At this stage, it will most likely become clear that some of the data should be preserved over time for reuse.

    Generally the data can be organized as entities, attributes, and relationships. There are likely to be many different types of entities (as demonstrated by the different set of attributes associated with each type, and for each type there are likely to be multiple instances e.g. an entity type of Person might have the attributes of: age, gender, and name. 'Bob' and 'Mary' might be examples of 'Person' entities -- they have the same attributes, just different values for those attributes. All of this corresponds to the first steps in designing your database: Entities are tables, attributes are columns in the table, and the individual instances (e.g. Bob and Mary) are rows in the table.)

    Jumping forward, after developing (the first draft of) your data model, you need to start to detail out the various transformations your data will need to take on its path from being input, to becoming output. This will help you start to organize the functions and/or 'classes' (if using object oriented programming -- Highly Recommended for anything beyond trivial.)

    The user interface (the "Front End") is what most people think of as 'the program', and this is where you start to incorporate MVC models and such.

    When starting out on a new project, it often helps to explore the 'Problem Domain' by putting together small demo programs, that might later become part of a prototype, and eventually be incorporated in a final project.

    There are various theories about the best way to organize a development project, but many of these are really only appropriate for people who 'have done it before'. In other words, the best way to organize a project for learning (i.e. just starting out) is often quite different from how an experienced team would organize it for efficient development.

    Good luck with your project.

    Harrison
    {{ DiscussionBoard.errors[4460185].message }}
  • Profile picture of the author r4inna
    Also you should lock access to MySQL (port 3306) via firewall to avoid hacking attempts. And implement SSH tunneling for administration needs
    {{ DiscussionBoard.errors[4535980].message }}
  • Profile picture of the author bettor
    First Do some reading about Database modeling so you can design your database tables first. Then do move to MVC (model view controller). there are some good frameworks out there which deliver mvc out of the box. Yii framework is one of the best in this and is very easy to use and is free.

    hope this helps
    {{ DiscussionBoard.errors[4547481].message }}
  • Profile picture of the author Ken Durham
    Signature

    yes, I am....

    {{ DiscussionBoard.errors[4553175].message }}
  • Profile picture of the author rallport
    As the OP is learning, I'd say jumping straight into MVC is a mistake and will only complicate things.

    As it's very important to your whole application, post a schema of your Database before you begin, so we can advise you.
    {{ DiscussionBoard.errors[4559969].message }}

Trending Topics