Search code examples
phpmysqli

How to use SQL and PHP to populate new pages in a site?


I'm working on a project, in which it is required for me to build a number of images which will be linked to pages containing information, which will be obtained from a database. Can someone suggest some tutorials to help me achieve this as I don't know what to search for?

My end goal is something similar to http://www.booking.com/city/bg/sofia.en-gb.html?sid=952e191dc66b2059dfc22f7c4d2f33ef;dcid=1;city=-838489;ilp=1 where I can click the hotel name or image and go to a page which gives information about the particular hotel selected.

Clarification of the question

My project involves 2 sets of pages, the main pages and a number of link pages. A super simple example of a main page:

<body>
  <h1>Home</h1>
    <a href='info.php[kidsparties]'>Kid's Parties</a>
    <a href= 'info.php[teenparties]'>Teen Parties</a>
    ...
   <a href='info.php[schoolparties]'>School Parties</a>
<body>

When the links are clicked they will lead to a page of the same structure but with different information. For example if the first link is selected:

<body>
  <h1>Kid's Parties</h1>
   <p>Some text here</p>
</body>

Solution

  • Create the following tables:

    Images (id, src, datetime);
    Content (id, content, user_id, created, updated); 
    content_img (id, content_id, image_id); 
    

    If you are making a CMS for the school, be prepared to be required to make Page Roles, this is levels of user permission etc. Administrator, Moderator, Student etc.

    Acitivity_log,

    id, 
    user_id, 
    action, 
    object_id,
    description,
    datetime,
    

    This can look like this:

    id: 4b340550242239
    user_id: 1546058
    action: "Edit"
    object_id: 887987779879
    description: 'User1 edited article "An Introduction to Psychology 101" '
    datetime: 2015-07-21 14:30:59