5 Replies - 2504 Views - Last Post: 14 June 2012 - 08:50 PM Rate Topic: -----

#1 MaBrunet  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 13-June 12

Create user specific content on my website

Posted 13 June 2012 - 01:36 PM

Hi,

I'm trying to find a n00b's tutorial on how to create user specific content for users that register on my website. At least, I'd like to know where to start. The user specific content would be accessible only by the user himself (not public).

Since I want to be clear and that I am new to this, here is an exemple of what I would like to see happen:
A registered user is navigating the website and is looking at a calendar of upcomming events in a city close to him. I would want to have a button next to the event that says "Add to my calendar" (A little like adding items to a cart on an online shop). He/she could then click on (let say) "My page" and access the general template with his user specific content.

This content would have to be saved in the Database so it can be re-accessed at any time by the user.

I'd like to know what I have to do to make that happen (what software to use, what I should be looking into,...)

So far I've been told to:

-Use Java
-Use PHP
-Use MVC
-Use MySQL

But I've not been given a starting point or a process to follow.

[I don't mind putting in the hours to learn, but just being told: "you should create columns in your Database and assign..." it means nothing to me. How do I create columns? Using what? Why? How will that generate user specific content?] - As you can see, I'm quite a newbe :( but I want to learn.

Thanks.

Is This A Good Question/Topic? 0
  • +

Replies To: Create user specific content on my website

#2 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 943
  • View blog
  • Posts: 2,353
  • Joined: 15-February 11

Re: Create user specific content on my website

Posted 13 June 2012 - 02:33 PM

Hey MaBrunet, firstly it would be better if you at least know the basics of PHP, MySQL and HTML (including CSS and Javascript for design and so forth). Let's more concentrate on the PHP and MySQL aspect.

If data is to be user specific then you are going to be utilizing relationship and foreign keys on the database level. Here are two tutorials that will be helpful:


Here's a small example of simple structure to book an user to an appointment.
Let's say you have a user table like this:
User
-username --Primary Key
-date_of_birth
-last_login


Username's the primary key so therefore it will be used in your relationships with other tables. Now let's also add a Events table
Events
-event_id --Primary Key
-event_name
-event_summary
-event_date


In order for you to join both tables you'll need a third table called, say Appointments.
Appointments
-appointment_id --Primary Key
-username --Foreign Key (User)
-event_id --Foreign Key (Events)


This could be a many to many relationship if you want many users to be able to book many appointments which makes sense. A query to select all the appointments along with the username and so forth will go like this:
SELECT U.username, E.event_name FROM Appointments A INNER JOIN User U ON U.username = A.username INNER JOIN Events E ON E.event_id = A.event_id


So you see that you'll need to learn relationships, joins and keys to design the database. The tutorial I linked earlier on Normalization will show you how to create proper database structures.

On the PHP level you should learn either MySQLi or PDO. Note that MySQLi and MySQL are two different APIs used to communicate with a MySQL database. The reason being is that you should use Prepared Statements instead of plain old string manipulated queries when including user input into your query. Knowing the basics of PHP should be enough seeing how this application relies mostly on the database.

Don't look at the entire project at once because you will be overwhelmed but work on querying a database then build from there.
Was This Post Helpful? 4
  • +
  • -

#3 MaBrunet  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 13-June 12

Re: Create user specific content on my website

Posted 14 June 2012 - 08:17 AM

codeprada,

Thank you for your kind help on this matter! I will look into those two tutorials :)

One more thing. Once I have the hang of it, how do I incorporate the user specific info into a page that I designed with Dreamweaver let's say? In other words, if I have my template ready, how do I make the info appear where I want them to appear and in the format I want them in, always considering that it will be a different content for all users but always in the same format?

Thanks again!
Was This Post Helpful? 0
  • +
  • -

#4 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 943
  • View blog
  • Posts: 2,353
  • Joined: 15-February 11

Re: Create user specific content on my website

Posted 14 June 2012 - 08:37 AM

You can directly place the values into your page or use a template engine to do so. You have a lot more flexibility with a template engine however but there's a learning curve. I recommend Smarty's PHP Template Engine because it's very easy to learn and catch on to. Check out my two tutorials on it:

Was This Post Helpful? 2
  • +
  • -

#5 MaBrunet  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 13-June 12

Re: Create user specific content on my website

Posted 14 June 2012 - 12:51 PM

This is truly helpful! Got to say, it's the first time I've posted a question on a forum in my life and I didn't expect much since I've read through a few forums and often, the responses don't answer the initial questions. Other times, the answers are too advanced for me to grasp the idea and I just have to keep looking for something easier...

It's nice of you to take the time and I appreciate it. It's crazy the amount of information you need to know and understand in order to create a decent project :P
Was This Post Helpful? 0
  • +
  • -

#6 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 943
  • View blog
  • Posts: 2,353
  • Joined: 15-February 11

Re: Create user specific content on my website

Posted 14 June 2012 - 08:50 PM

You're welcome and good luck on the project.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1