Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Oct 2007
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    passing variables to mysql

    Ok so, here is my new problem.

    My script works out a variable (the users ip) and then needs to pass it to a mysql table.
    Quite simple.

    But the trciky bit is that I need my php to run this style of script before it posts the data to the sql.

    Does the table for this hour exist? y/n (there will only ever be one hour table which needs to be overwritten each hour)
    Does the table for this day exist? y/n (there will be a new table for each day)
    Does the table for this week exist? y/n (there will be a new table for each week)
    Does the table for this month exist? y/n (there will be a new table for each month)

    Create the corresponding table if neccesarry.
    Post the data to the all the corresponding tables according to the time and date.

    By doing this I am keeping all the tables amended and can pull them back into another php file which will read the data and post it accordingly.

    Ok cool. I hope someone has done this before, as im quite unsure how to do this.

  • #2
    Senior Coder nikos101's Avatar
    Join Date
    Dec 2006
    Location
    London
    Posts
    1,007
    Thanks
    59
    Thanked 10 Times in 10 Posts

    Question

    Quote Originally Posted by eon201 View Post
    Does the table for this hour exist? y/n (there will only ever be one hour table which needs to be overwritten each hour)
    Does the table for this day exist? y/n (there will be a new table for each day)
    Does the table for this week exist? y/n (there will be a new table for each week)
    Does the table for this month exist? y/n (there will be a new table for each month)
    Do you not mean is there a value in the column for this "value" exist? Your going to have a load of tables otherwise.
    Last edited by nikos101; 11-15-2007 at 10:33 AM.


  • #3
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    I wonder why people do this?

    Tables are not a good method of seperating data.

    Read up on Database Normalization. This should be natural to any DB developer.

  • #4
    Senior Coder nikos101's Avatar
    Join Date
    Dec 2006
    Location
    London
    Posts
    1,007
    Thanks
    59
    Thanked 10 Times in 10 Posts
    Quote Originally Posted by aedrin View Post
    I wonder why people do this?

    Tables are not a good method of seperating data.

    Read up on Database Normalization. This should be natural to any DB developer.
    I never quite understood well beyond the 5th form


  • #5
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    I think only the first 2 or 3 normal forms are really important to know.

    After that you get into more complexities which might not be as helpful (for small scale systems, at enterprise level this is not true).

  • #6
    Senior Coder nikos101's Avatar
    Join Date
    Dec 2006
    Location
    London
    Posts
    1,007
    Thanks
    59
    Thanked 10 Times in 10 Posts
    Did you ever get into running concurrent databases on different servers for extreme uptime or for multiple processing power? I want to get there!


  • #7
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    Nope, I haven't.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •