Announcement

Collapse
No announcement yet.

PHP help. Any experts out there?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP help. Any experts out there?

    Need some help with PHP/MySQL programming, is anyone here a programmer?
    signatures are for pussies mew mew mew, here's mine


  • #2
    Re: PHP help. Any experts out there?

    I've done a good bit of PHP/MySQL, but not for some time... What do you need specifically?

    Comment


    • #3
      Re: PHP help. Any experts out there?

      As posted on another forum:

      I've been trying for the past few days to accomplish something that I finally deemed out of my league when it comes to programming.

      I need to create/generate a graphical display that shows when and where a team needs to be at a certain time in a day.

      My MYSQL Table returns the following information:

      TEAM_ID | CLIENT / LOCATION | BEGIN HOUR | END HOUR | DAY |
      1 | FOO | 8 | 11 | 2008-06-07 |
      1 | BAR | 9 | 12 | 2008-06-07 |
      2 | FOO | 10 | 13 | 2008-06-07 |
      2 | JOE | 15 | 18 | 2008-06-07 |
      3 | FOO | 18 | 20 | 2008-06-07 |
      3 | JOE | 10 | 19 | 2008-06-07 |
      4 | BAR | 8 | 14 | 2008-06-07 |


      I can display this information easily, but my client needs it to be displayed graphically.

      I've ran into some problems trying to do it by myself, mainly due to overlapping events (which are allowed to occur), therefore I wanted to ask anyone out there to see if they had a suggestion I could follow, a tutorial or some other type of help, anything would be greatly appreciated.

      ps, Because there will be recurring events, the check for overlapped events needs to be done at "runtime", I have no idea how to achieve this...

      I've added a picture to illustrate the required output.

      signatures are for pussies mew mew mew, here's mine

      Comment


      • #4
        Re: PHP help. Any experts out there?

        I suggest you look at the HTML TABLE tag, and particularly the COLSPAN attribute of the TD tag; it should be quite possible to generate this purely as an HTML table. If you really want to generate it as an image, I can't really help you on that, you'll need to look at image-generation packages that integrate with PHP.

        As a sort of example, without the angle brackets:
        TD 1 /TD
        TD COLSPAN=3 BGCOLOR="blue" FOO /TD
        TD COLSPAN=13 BGCOLOR="white" /TD
        Kumei, pickpocket of Midgardsormr(Bastok Rank 10)
        DRK99,DNC91,THF90
        Alchemy 72, Smithing 51, Goldsmithing 48, Leathercraft 23, Fishing 20
        Koren, San d'Orian Adv.(Rank 10)
        WHM95,BLM90,SMN85,RDM82,SCH49
        Woodworking 29,Cooking 20
        All celestials(Trial-Size), Fenrir, Diabolos, Alexander, Odin
        Myrna, Windurstian Merchant
        Clothcraft 24
        Nyamohrreh, Windurstian Adv.(Rank 6)
        BST90,WHM56,DNC45

        Comment


        • #5
          Re: PHP help. Any experts out there?

          If you are looking for vector-base graphics on webpages, I suggest this Javascript library:

          DHTML: Draw Line, Ellipse, Oval, Circle, Polyline, Polygon, Triangle with JavaScript

          It is a free software under GNU Lesser General Public License.

          I had used this package to render pie-graph for some statistic report (Web-page) for my clients, it works on IE6, IE7, FireFox 3.... it works even on printing on paper.

          Hopefully it helps. Your project sounds very interesting. Have fun and good luck ^^b
          Server: Quetzalcoatl
          Race: Hume Rank 7
          75 PLD, 75 SAM, 75 WAR, 75 NIN, 75 MNK, 65 BLU

          Comment


          • #6
            Re: PHP help. Any experts out there?

            The image was just to illustrate how it would look like, it can be done by using tables or what have you. The problem is the actual code to find overlapping occurrences, its driving me nuts.
            signatures are for pussies mew mew mew, here's mine

            Comment


            • #7
              Re: PHP help. Any experts out there?

              Since my experience with on-the-fly generation of graphics is fairly limited, I would go Luna's route and make it pure HTML, but that's just me. It seems you would be able to label each of the sections easier, plus having border=1 would make it look a little nicer IMO so you can see where things line up with times, which would be especially helpful when you have a large number of clients (I'm always thinking of expandability when I do projects like the one you're doing). Plus, it's also easier to generate a "frequency" of repeating the heading, so every 5-10 rows is displays the hours again, which also helps with large numbers of clients.

              Pseudo Code:
              while (rownum <= numrows) { //Each entry in the DB should have a unique identifier key, rownum, and numrows being COUNT(*) of the table
              for (x = 0; x < start_hour - offset; x++) { //start_hour is from the DB, offset is the first hour to be displayed (in the image, for example, offset = 8)
              echo "<td></td>n"; //This aligns the first column for the event with blank cells
              }
              span = end_hour - start_hour; //total hours for the event
              echo "<td colspan=span>event_name</td>n"
              }
              Punctuation and some minor tweaking would probably be needed... it's been a while since I've done my last project (though I really should get on the one I've had in mind for the last couple months). You should be able to get the general gist of the code above and do it to your own style.

              Just my take on the whole thing though.

              Edit: Since this code does everything row by row, the only thing you need to do to handle overlapping on the same event is to add a little code at the beginning that does a COUNT(Team_ID = x) where X is increased every pass of a FOR loop, then say <tr> <td rowspan = that count>Team_ID</td>. That'll have the team's ID spanned vertically for each row it takes up.

              The only problem is that the rows aren't consolidated like you have in the image (2 events on one line) but if I thought about it for a little bit I'm sure I could come up with some code that would work for it.

              I'm actually kinda interested in helping with this, if you want. PM me and we can chat over AIM/MSN or whatever.
              Last edited by KingOfZeal; 07-21-2008, 12:18 PM.
              Kindadarii (Bahamut)
              90PUP / 90SMN / 90BRD / 90WHM / 59DNC
              70.3 + 2 Woodworking
              52.2 Synergy


              Breeding Chocobos? Visit Chocobreeder.com to find chocobos in your area!

              Comment


              • #8
                Re: PHP help. Any experts out there?

                Ah, I misread the table in the image, then.

                I think there was a problem similar to this in my Algorithms class, but it's been several years. I'll see if I can dig something up and post it later.
                Kumei, pickpocket of Midgardsormr(Bastok Rank 10)
                DRK99,DNC91,THF90
                Alchemy 72, Smithing 51, Goldsmithing 48, Leathercraft 23, Fishing 20
                Koren, San d'Orian Adv.(Rank 10)
                WHM95,BLM90,SMN85,RDM82,SCH49
                Woodworking 29,Cooking 20
                All celestials(Trial-Size), Fenrir, Diabolos, Alexander, Odin
                Myrna, Windurstian Merchant
                Clothcraft 24
                Nyamohrreh, Windurstian Adv.(Rank 6)
                BST90,WHM56,DNC45

                Comment


                • #9
                  Re: PHP help. Any experts out there?

                  Ah... a friend of mine helped me a moment ago. My problems are gone, we used a multiple dimension array in the end.

                  Checks it out on the attached image.

                  Thank you so much for the input though, everyone

                  (I will probably show off the full application here once its done and get some people to beta test it for me, for 10 moneys ^^)
                  Attached Files
                  signatures are for pussies mew mew mew, here's mine

                  Comment


                  • #10
                    Re: PHP help. Any experts out there?

                    Yeah, didn't figure it'd be too horribly complicated in the end, the thing that made the version that came up in Algorithms class a nightmare was that we had to produce something that put together schedules without overlaps within a given per-input efficiency threshold.
                    Kumei, pickpocket of Midgardsormr(Bastok Rank 10)
                    DRK99,DNC91,THF90
                    Alchemy 72, Smithing 51, Goldsmithing 48, Leathercraft 23, Fishing 20
                    Koren, San d'Orian Adv.(Rank 10)
                    WHM95,BLM90,SMN85,RDM82,SCH49
                    Woodworking 29,Cooking 20
                    All celestials(Trial-Size), Fenrir, Diabolos, Alexander, Odin
                    Myrna, Windurstian Merchant
                    Clothcraft 24
                    Nyamohrreh, Windurstian Adv.(Rank 6)
                    BST90,WHM56,DNC45

                    Comment

                    Working...
                    X