FRIHOSTFORUMSSEARCHFAQTOSBLOGSCOMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Making a Clients Area Help





Relentless
Hey Guys.

I have been reading up on tutorials on how to make login systems etc, But now I want to make a simple to use clients area for my clients of my website design to login and contact me, see when there hosting is due to expire, or domain name expirary or simple hosting requests.

What is the best way to make the MySQL database?

As I say I have 5 clients each client will consist of the folowing data:

    •Fist Name
    •Surname Name
    •Username
    •Password
    •email
    •Full address
    •Domain name
    •Hosted yes or no
    •Other variables

    PLUS:

    • An SQL comment system for each client to send "Virtual Emails" like a Ticket System.



Do I make the database and make a table for each user or one table with 1 rows per user and 9+ columns?

Some help will be great,

Dan Smile
Asap170
I am not sure what your really asking. If you want a page where only "clients" can get into then I would make another row in your MySQL Table called "accType" and make it set to what it should be. Then register a session or cookie depending on what your using and check at the beginning of the page and if it doesn't match up then it goes to home or displays an error message. Hope that helps.

Kind Regards,
Asap170
Fire Boar
You need to make one table, each column should represent a piece of data held about the user (name, email address, etc) and each row should represent one user.

You absolutely should not have one table per user. That approach doesn't scale at all - you only have 5 users now, but think what a similar system would be like with 500 or even 50,000 users.

Regarding a ticket system, you should make a second table, in which one of the columns should be the user ID of the person who sent the ticket.
Relentless
Thank you for your reply Fire Boar!

But have a question about:
Fire Boar wrote:

Regarding a ticket system, you should make a second table, in which one of the columns should be the user ID of the person who sent the ticket.


I would need a php script that searches that table for the id in use and pull all the relevant data right?

So I have:

Code:

Ticket ID      Ticket Subject      Ticket content(HTML)      Ticket Date          UserID
5            Hosting          Hi bla bla bla bla..      21 10 2011      3
6            connection       Hi bla bla bla bla..      21 10 2011      5
7            something else       Hi bla bla bla bla..      21 10 2011      3
8            something          Hi bla bla bla bla..      21 10 2011      2
9            meh             Hi bla bla bla bla..      21 10 2011      1


So for UserID "3" that would pull Ticket 5 and 7. Is that the best why to code that?
Fire Boar
Yes, exactly. Here UserID is a foreign key, meaning that it references another column in some table (your user table's ID column, in this case), and should only take values that exist in said column. You can enforce this using some table formats, like InnoDB, but MySQL's default MyISAM doesn't enforce foreign key constraints, so you just have to be a bit careful about coding. For instance, if a user is deleted then each ticket for that user should either be deleted also (cascade strategy) or have its UserID set to null (set null strategy). Otherwise you could get some nasty errors if, say, you want to show a list of all tickets and the name and email address of the person who opened each.
Related topics
science vs. religion
Santeros
Need help making logout script
Need help with Members area/link adder
Explain your current signature!!!
Should SUICIDE be ilegal?
hello im new
PHP, FORM HELP
I urgently need this done for $50 frih!
Form help
Using php to change content of a .txt
Occupy’s Serial Rapist Protected by Mob’s Code of Silence
Email Clients / Websites Help!
I Need to be active on here more
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.