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 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP newbie question

    I'm hoping some of you PHP experts here can help me out with either a little sample script or possibly pointing me in the direction where I may find one. Iím pretty new to learning PHP, but making some progress, from wha I have learned via a book I picked up, ďPHP For The World Wide WebĒ written by a Larry Ullman. Iím building a new site for my fantasy leagues, and here is what Iím basically trying to do.

    Each week, all my fantasy reports generate files that begin with first their year, then their week such that a file with the beginning of 0201 would be the 02 season, week 01, then 0202, 0203, and so on for the corresponding weeks. I place my reports menus on the left running vertically with a weeks menu running horizontally across the page. What I want to do is let my users be capable of going back to prior weeks to see results. So that if someone wanted to go back to say week 3, that when they choose any specific report, it would choose the correct week 3 (ie: 0203) reports. Iím not quite sure how to do it, but I think I need to first create the weeks menu so that hopefully it would open up the website based on the current week by searching for the latest seasons file. Then I quess create something that will first look at the week your in, so that the menu will know to look for that weeks files.

    Iím not sure how difficult something like this is, but I could use all the help I could get. The seasonís approaching fast, and the book I have is a little overwhelming for me, plus I donít see anything like that in here. The book mainly focused on creating a form, which I donít believe will help me to much.

    Thanks
    Switch

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    It would be much easier to use a database for this.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm Reading Reading, and more Reading! I just learned a little bit about mysql and databases via some of the tutorials. I've figured out that my webhost server has already assigned me a database, and that now I need to create a table of somekind. Am I correct here in thinking that I need to create a table of something like this"

    ID Season Week
    1 02 01
    2 02 02
    3 03 03
    etc...

    What I'm unsure of in creating the table is on the season and week part, on how to create the 02. Would this be an integer, TEXT or something else. And then how eventually I get this table to work with the reports I've created.

    I am getting on the right track here? I apologize if all this seems so basic.
    Last edited by Switch17; 08-03-2002 at 03:04 PM.

  • #4
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Yes. As far as the structure of your table(s) it all depends on what data you have and how you want to store it. You can check out some of the posts in the MySQL forum to help with designing the database for this. There are plenty of links in there such as in this one:

    Article based website

    The PHP part of this is very easy. The hard part which really isn't that hard is setting up the database for it. I will also move this thread over to the MySQL forum. Once you have the database all set up we can help you in this forum to set up the php for generating the pages for your reports using templates and dynamically populating the reports from the database.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Spookster, Thanks for moving this over to the mysql forum area. I'm working on the data base, but I'm unsure if I'm progressing properly. I've set the Year and Week's up as characters and not numbers. Here's a little of what I've done so far. If it looks right, I'll continue making the database for all the seasons and weeks.

    Code:
    # phpMyAdmin MySQL-Dump
    # version 2.2.0
    # http://phpwizard.net/phpMyAdmin/
    # http://phpmyadmin.sourceforge.net/ (download page)
    #
    # Host: localhost
    # Generation Time: August 4, 2002, 2:13 pm
    # Server version: 3.23.41
    # PHP Version: 4.1.1
    # Database : `xxxxxxl_com`
    # --------------------------------------------------------
    
    #
    # Table structure for table `week_index`
    #
    
    CREATE TABLE week_index (
      ID int(11) NOT NULL auto_increment,
      Season year(4) NOT NULL default '0000',
      Year char(2) NOT NULL default '0',
      Week char(2) NOT NULL default '0',
      PRIMARY KEY  (ID)
    ) TYPE=MyISAM;
    
    #
    # Dumping data for table `week_index`
    #
    
    INSERT INTO week_index VALUES (1,'2001','01','01');
    INSERT INTO week_index VALUES (2,'2001','01','02');
    INSERT INTO week_index VALUES (3,'2001','01','03');


  •  

    Posting Permissions

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