Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: "Inventory" for HTML RPG  (Read 49830 times)

0 Members and 1 Guest are viewing this topic.

Dilbert

    Topic Starter
  • Moderator


  • Egghead

  • Welcome to ComputerHope!
  • Thanked: 44
    "Inventory" for HTML RPG
    « on: March 19, 2006, 04:36:44 PM »
    *Caution: Long introduction follows*

    When I was learning HTML, my method of learning about text, hyperlinks and basic formatting was the Choose Your Own Adventure games. Inspired by the many books, I have created several versions that are too small to publish or were so full of cliches that I would have been ridiculed. I love doing RPGs of this kind; it provides a challenge for both the writer and the reader.

    Each installment, I try to add something new. CYOA I was a 15-page total (including wins and losses) mini-adventure. CYOA II was never actually undertaken, as I tried to bite off things I'm not sure I can chew today.

    CYOA III was built entirely in FrontPage but didn't have too much more. Of note was the pictures, background music, and buttons. I tried including an inventory, but failed to find a method. I had one, but it was actually a decoration at best; not a fully functioning inventory system. However, I was able to get away with it as it was relatively unimportant. (Bolded part is important to note)

    CYOA IV was the first version to have multiple storylines but didn't require the completion of both. In 3, if you didn't complete both missions, you lost. This took a little of the CHOOSE out of it. Alternate storylines provided a gameplay that myself and my sisters enjoyed.

    I am beginning the planning stages for a CYOA V. It will have all of the innovative new features I had or wanted to have before. (This one I will not build in FrontPage, but I will use it just to steal button images ;)) One of the features that I desperately wanted to integrate into the system was a fully functional inventory system. This will make the game more dynamic by allowing more choices, and more chances to screw up.

    For example, in my last installmnent featuring the Great Pyramid, whenever the main character and his (your) friend needed to fight, there was always a sword convienently handy. I was required to do this because, with my knowledge at the time, if I wanted to do an inventory system, I'd have to exponentially increase the number of pages: One for with no items, one for with sword only, one for with bow only, one for both... too much of a headache. My project was nearing the 100-page mark as it was. So I had to bite the bullet and accept the inconsistiencies of my game. It wasn't easy.

    My other desired idea also came from CYOA IV. In the latter half of the main adventure, the two main characters are captured by a mad long-dead pharaoh who asks "morality" questions and tortures you or your companion, depending on what answer you gave. Four questions would be asked, and each bolt would take off 25% health. To make it more challenging, your friend is at 50% since he was captured first, and you have to balance to keep both of you alive. Not all that challenging, but it was designed with my then-9 year old sister in mind. (The torture scenes were not graphic and had no pictures at all; just a lighting sound ripped from Star Wars)

    What's the problem with the above paragraph? Well, in order to set up a health system, I had to create what I called a "knot of pages" with you at 100% friend at 50%, you at 75% him at 50%... you get the idea. I know there's an easier way to do all of this, but I didn't then.


    So, after all of that, you have to know exactly what I want and how I want to apply it. What I want is to create an inventory system that works on multiple pages. I think it will require frames to get it to stay from page to page, but that doesn't get the actual inventory going, obviously. The other thing I want is a health system, so I can damage players or NPCs as needed, or restore their health. I know it's going to require something along the lines of JavaScripting, and I'm not afraid of that, but I am not sure where to begin. What I need is advice on how to do this.

    To test out any replies that I'm getting, I will set up test page(s) with buttons to decrease a health bar and one to take in and out imagined inventory items. I'm sorry for the possibly excessive background, but I wanted to make sure every card was on the table. :)
    « Last Edit: March 19, 2006, 04:38:24 PM by Timothy_Bennett »
    "The geek shall inherit the Earth."

    Rob Pomeroy



      Prodigy

    • Systems Architect
    • Thanked: 124
      • Me
    • Experience: Expert
    • OS: Other
    Re: "Inventory" for HTML RPG
    « Reply #1 on: March 19, 2006, 09:37:54 PM »
    If you're serious about doing this with javascript, then pick up the nearest pen on your desk and jab yourself smartly in the eye with it, because honestly it would be less painful.  Javascript is okay with cookies, which you can use to carry variables over from one page to the next, but it is not great at truly dynamic content.

    If you've managed to persuade your mother that it is safe to host your own web site, then now would be a brilliant time to learn PHP, which you can install and run on your server.

    Incidentally, I remember your signature said something about the nightmare your parents had when you discovered the control panel.  Could this explain their reluctance to let you host a web site?  ;)
    « Last Edit: March 19, 2006, 09:38:37 PM by robpomeroy »
    Only able to visit the forums sporadically, sorry.

    Geek & Dummy - honest news, reviews and howtos

    Dilbert

      Topic Starter
    • Moderator


    • Egghead

    • Welcome to ComputerHope!
    • Thanked: 44
      Re: "Inventory" for HTML RPG
      « Reply #2 on: March 19, 2006, 10:55:36 PM »
      My mom said I can put something on the Internet when it has more value than a "hello world" type site. Truly, that's what the site I was making was. Oh well. She's still not convinced, but if I can show her something of great value, then it might be the leverage I need. If not... well, my sisters can play this at least. :)

      Quote
      If you're serious about doing this with javascript, then pick up the nearest pen on your desk and jab yourself smartly in the eye with it, because honestly it would be less painful.  Javascript is okay with cookies, which you can use to carry variables over from one page to the next, but it is not great at truly dynamic content.

      LOL. I wasn't trying to insinuate that I was going to use JavaScript no matter what. I had the feeling it was possible, so I mentioned it. I could also use VBScript if that can work, but so many people have that off to protect their systems that it's useless.

      Quote
      If you've managed to persuade your mother that it is safe to host your own web site, then now would be a brilliant time to learn PHP, which you can install and run on your server.

      Question: Can that work offline as well? I'm a big fan of being able to test things out offline before launching them, and I'd like to be able to play this offline just in case I'm still rejected. Which I doubt will happen, knowing my mother. ;)

      I'd be happy to learn whatever works to get the game running as efficiently as possible. I'm not a big fan of things that take up upwards of 400 MB if I can help it, and I'm sure that I could help it on my other games.

      Anyway, if PHP is the way to go, I'll Google some tutorials. I did just a second ago, and it seems to be able to function offline, like JavaScript. I hope it works offline, anyway. Just another language to pseudo-learn. :D

      Quote
      Incidentally, I remember your signature said something about the nightmare your parents had when you discovered the control panel.  Could this explain their reluctance to let you host a web site?  

      Her big fear is still hackers. And they are indeed a threat to computers everywhere, but my router seems to be doing excellently at keeping us safe. :)

      [edit]PHP appears like a cross between Visual Basic, JavaScript, and DOS Batch files. What do you know - the three languages I know best (Not counting English). This can't be too hard... (famous last words...)[/edit]
      « Last Edit: March 19, 2006, 11:19:50 PM by Timothy_Bennett »
      "The geek shall inherit the Earth."

      Rob Pomeroy



        Prodigy

      • Systems Architect
      • Thanked: 124
        • Me
      • Experience: Expert
      • OS: Other
      Re: "Inventory" for HTML RPG
      « Reply #3 on: March 20, 2006, 03:19:10 AM »
      Quote
      My mom said I can put something on the Internet when it has more value than a "hello world" type site.
      Surely she understands that all great programmers begin with "hello world"!!!  It's part of the learning process...
      Quote
      Question: Can [PHP] work offline as well?
      That depends on what you mean by "offline".

      PHP sits on the web server, and processes requests made to the web server, modifying the HTML output as required.  If your web server were offline, and you were merely accessing cached versions of pages, then no, PHP would not help.

      If your web server is working however, then the dynamic content will be generated.  And this is irrespective of whether the end user is on your LAN or beyond your router.

      So basically, you have the opportunity to test fully your site before you open up the relevant port on your router and let the world at large see your efforts.  I think that was what you were hoping.  :)
      Quote
      Her big fear is still hackers.
      Again, if she is so concerned about this, perhaps HER computer should not be connected to the internet at all.  Does she understand PC security?  No system is 100% safe.  But then that is just as true OFF the internet, what with identity theft criminals rummaging through your rubbish and all...
      Quote
      PHP appears like a cross between Visual Basic, JavaScript, and DOS Batch files.
      Well I can sort of see the point.  PHP is not strictly-typed (like for example C), so it can be almost as forgiving as javascript, and it shares a lot of functionality with VB.  I'm not sure the PHP developers would welcome the comparison with VB though!  PHP really excels at web-based taks, particularly since they involve lots of text processing.  This is where PHP is highly optimised.
      Quote
      This can't be too hard... (famous last words...)
      Hmm...

      At least you can come back here if you get stuck; plus there are LOADS of PHP resources out there, as you have already discovered.  If you go for PHP, bookmark >the online manual< and forget about using web design software for most of your development.  Go for something like PHPEditorIDE or Notepad++.  PHPEditorIDE is particularly good for starting off, because it includes PHP and CSS context-sensitive help.  I prefer Notepad++ though, because it is more robust.  Both provide syntax highlighting etc.  Both are free (naturally).  :)
      « Last Edit: March 20, 2006, 03:19:40 AM by robpomeroy »
      Only able to visit the forums sporadically, sorry.

      Geek & Dummy - honest news, reviews and howtos

      Dilbert

        Topic Starter
      • Moderator


      • Egghead

      • Welcome to ComputerHope!
      • Thanked: 44
        Re: "Inventory" for HTML RPG
        « Reply #4 on: March 20, 2006, 08:14:27 AM »
        Quote
        Surely she understands that all great programmers begin with "hello world"!!!  It's part of the learning process...

        Of course, she's only saying that I can't publish it since it's so small. I gotta agree with her on that one; it serves no purpose. However, I've been doing HTML for a few years and know my way around it enough to produce a great Web-based game. It's just getting all the features to work that are the issue.

        Quote
        That depends on what you mean by "offline".

        PHP sits on the web server, and processes requests made to the web server, modifying the HTML output as required.  If your web server were offline, and you were merely accessing cached versions of pages, then no, PHP would not help.

        If your web server is working however, then the dynamic content will be generated.  And this is irrespective of whether the end user is on your LAN or beyond your router.

        So basically, you have the opportunity to test fully your site before you open up the relevant port on your router and let the world at large see your efforts.  I think that was what you were hoping.  :)

        Right now, I've got just HTML pages, CSS files and the like sitting on my computer. How do I put these files physically on the server so I can test them?

        Quote
        Again, if she is so concerned about this, perhaps HER computer should not be connected to the internet at all.  Does she understand PC security?  No system is 100% safe.  But then that is just as true OFF the internet, what with identity theft criminals rummaging through your rubbish and all...

        LOL. She's breaking down, I just need one more piece, I think, to have her let me do it. :D

        Quote
        Well I can sort of see the point.  PHP is not strictly-typed (like for example C), so it can be almost as forgiving as javascript, and it shares a lot of functionality with VB.  I'm not sure the PHP developers would welcome the comparison with VB though!  PHP really excels at web-based taks, particularly since they involve lots of text processing.  This is where PHP is highly optimised.

        Oh, I know it's different. It's just that I see similarities:

        • The For, Do, and Do While loops are similar in nature to VB and syntax is like JavaScript
        • "echo" is like the "echo" in DOS BATCH files.
        • Mosy syntax is similar or identical to JavaScript.

        Frankly, I don't care what the PHP programmers say; it looks like it!
        Quote
        Hmm...

        At least you can come back here if you get stuck; plus there are LOADS of PHP resources out there, as you have already discovered.  If you go for PHP, bookmark >the online manual< and forget about using web design software for most of your development.  Go for something like PHPEditorIDE or Notepad++.  PHPEditorIDE is particularly good for starting off, because it includes PHP and CSS context-sensitive help.  I prefer Notepad++ though, because it is more robust.  Both provide syntax highlighting etc.  Both are free (naturally).  :)

        *bows* Thank you again.
        "The geek shall inherit the Earth."

        Rob Pomeroy



          Prodigy

        • Systems Architect
        • Thanked: 124
          • Me
        • Experience: Expert
        • OS: Other
        Re: "Inventory" for HTML RPG
        « Reply #5 on: March 20, 2006, 08:53:07 AM »
        Quote
        Right now, I've got just HTML pages, CSS files and the like sitting on my computer. How do I put these files physically on the server so I can test them?
        You installed Apache, didn't you?  My Apache experience is all on *nix systems, so bear with me.  I think the default web root is at C:\Program Files\Apache Group\Apache2\htdocs.  That's where your files go.

        Later on, it would be desirable to edit the Apache config file, and put your webroot somewhere else - typically a top level directory on a different partition/hard drive.  This slightly enhances security and tends also to enhance performance.  But you can save that for another day.  Apache config file editing is a black art and takes some getting used to.
        Only able to visit the forums sporadically, sorry.

        Geek & Dummy - honest news, reviews and howtos

        Dilbert

          Topic Starter
        • Moderator


        • Egghead

        • Welcome to ComputerHope!
        • Thanked: 44
          Re: "Inventory" for HTML RPG
          « Reply #6 on: March 20, 2006, 04:27:32 PM »
          Quote
          Quote
          Right now, I've got just HTML pages, CSS files and the like sitting on my computer. How do I put these files physically on the server so I can test them?
          You installed Apache, didn't you?  My Apache experience is all on *nix systems, so bear with me.  I think the default web root is at C:\Program Files\Apache Group\Apache2\htdocs.  That's where your files go.

          Later on, it would be desirable to edit the Apache config file, and put your webroot somewhere else - typically a top level directory on a different partition/hard drive.  This slightly enhances security and tends also to enhance performance.  But you can save that for another day.  Apache config file editing is a black art and takes some getting used to.

          Ok, the folder exists. Inside the folder is a bunch of files I've never seen before. Extensions incluse .ISO-RU, .NN, .BIG5, and a ton of other files I don't recognize. A few GIFs and PNGs. I did a search inside the Apache folder and got a ton of .h files. I think one of them will have the data I want, but to me it looks like the grails at Indiana Jones and the Last Crusade. The true file... will give me a functioning server... the FALSE file... will take it from me...

          I can open these files with Dev C++. Unfortunately, I barely know anything about C++, not even enough for a "Hello World" program. All my experience has been in VB. Which file is the true file? And by that I mean the one that allows me to change the path.

          I do have the hard drive space needed to partition my drive, but I don't have any programs that can do that. Also, if I were to repartition it back to one drive, would I lose all my data or only the one that I got rid of? Just a question that needs asking. If this works I'll have no reason to remove it, it's juat a thought.
          « Last Edit: March 20, 2006, 04:29:24 PM by Timothy_Bennett »
          "The geek shall inherit the Earth."

          Rob Pomeroy



            Prodigy

          • Systems Architect
          • Thanked: 124
            • Me
          • Experience: Expert
          • OS: Other
          Re: "Inventory" for HTML RPG
          « Reply #7 on: March 20, 2006, 11:03:32 PM »
          The htdocs folder shouldn't really have much in it on a clean install.  Is there any index.* file in there?  The files may well just be introductory files, with various different translations.  (.big5 idenitifies a Chinese version, for example.)

          You can safely delete everything in the htdocs folder anyway (or move the contents elsewhere).  Just plop in a basic index.html, and then browse to http://127.0.0.1 to verify that it's working.

          You'll probably find the configuration file httpd.conf in a folder called "etc".

          Partitioning is not my speciality; it may not be possible to merge two partitions, so I wouldn't count on it.  Ask the other guys around here.  :)
          « Last Edit: March 20, 2006, 11:04:55 PM by robpomeroy »
          Only able to visit the forums sporadically, sorry.

          Geek & Dummy - honest news, reviews and howtos

          Dilbert

            Topic Starter
          • Moderator


          • Egghead

          • Welcome to ComputerHope!
          • Thanked: 44
            Re: "Inventory" for HTML RPG
            « Reply #8 on: March 20, 2006, 11:30:57 PM »
            There are index.html.en, and index.html.et, and a lot of stuff like that. For cleanliness' sake, I deleted the folder's contents but will keep the recycled files just in case. :)

            Oh, cool! I can see my work on the web! And PHP will work here, correct? Sweet. This rocks; it's freaking awesome! Now all I have to do is finish the game, and open it to the public.

            *monotone* I rock. Out loud. */monotone*

            Sorry, that was just too cool. ;D Now that that bit's out of the way, I wonder exactly what PHP code would be good for something like this. I'll check out those tuts. :)
            « Last Edit: March 20, 2006, 11:33:48 PM by Timothy_Bennett »
            "The geek shall inherit the Earth."

            Rob Pomeroy



              Prodigy

            • Systems Architect
            • Thanked: 124
              • Me
            • Experience: Expert
            • OS: Other
            Re: "Inventory" for HTML RPG
            « Reply #9 on: March 21, 2006, 01:14:59 AM »
            Yes, you're up and running.  Now for the web page that your mother loves so much: helloworld.php


            <html>
            <body>
            <?php

              // If php is running correctly, this will display "Hello world!"
              echo '<p>Hello world!</p>';

            ?>
            </body>
            Only able to visit the forums sporadically, sorry.

            Geek & Dummy - honest news, reviews and howtos

            Rob Pomeroy



              Prodigy

            • Systems Architect
            • Thanked: 124
              • Me
            • Experience: Expert
            • OS: Other
            Re: "Inventory" for HTML RPG
            « Reply #10 on: March 21, 2006, 01:24:22 AM »
            As an aside, here's an example of the kind of thing you can do with PHP.  The following is a PHP script, not an image file:



            If you refresh this page later on, you'll see the hands update.  Note that the clock is showing UK time!  I can't take the credit for this clock script by the way.  I was about to write such a script, but I hate re-inventing the wheel, so I had a quick look for a PHP analogue clock, and I found >this<.
            « Last Edit: March 21, 2006, 01:27:20 AM by robpomeroy »
            Only able to visit the forums sporadically, sorry.

            Geek & Dummy - honest news, reviews and howtos

            Dilbert

              Topic Starter
            • Moderator


            • Egghead

            • Welcome to ComputerHope!
            • Thanked: 44
              Re: "Inventory" for HTML RPG
              « Reply #11 on: March 21, 2006, 08:36:16 AM »
              Quote
              Yes, you're up and running.  Now for the web page that your mother loves so much: helloworld.php


              <html>
              <body>
              <?php

                // If php is running correctly, this will display "Hello world!"
                echo '<p>Hello world!</p>';

              ?>
              </body>

              I made a PHP file with the information you gave, and tried it. The output was the full code. I tried a HTML with that PHP embedded, and the output was this:

              Hello world!'; ?>
              "The geek shall inherit the Earth."

              Rob Pomeroy



                Prodigy

              • Systems Architect
              • Thanked: 124
                • Me
              • Experience: Expert
              • OS: Other
              Re: "Inventory" for HTML RPG
              « Reply #12 on: March 21, 2006, 09:09:17 AM »
              You need to follow the installation instructions for PHP fully, including the part about how to set up Apache once PHP is installed.  Apache needs to know that .php files have to be handed off to the PHP engine before displaying the results.
              Only able to visit the forums sporadically, sorry.

              Geek & Dummy - honest news, reviews and howtos

              Dilbert

                Topic Starter
              • Moderator


              • Egghead

              • Welcome to ComputerHope!
              • Thanked: 44
                Re: "Inventory" for HTML RPG
                « Reply #13 on: March 21, 2006, 04:08:43 PM »
                I'm in the httpd.conf file and I'm having trouble finding it. Is that the correct file to set up the PHP? (It was in C:\Program files\Apache Group\Apache2\conf, by the way)
                "The geek shall inherit the Earth."

                Rob Pomeroy



                  Prodigy

                • Systems Architect
                • Thanked: 124
                  • Me
                • Experience: Expert
                • OS: Other
                Re: "Inventory" for HTML RPG
                « Reply #14 on: March 22, 2006, 03:18:30 AM »
                Yes, but have you followed >these< installation instructions, followed by >these<?
                Only able to visit the forums sporadically, sorry.

                Geek & Dummy - honest news, reviews and howtos

                Dilbert

                  Topic Starter
                • Moderator


                • Egghead

                • Welcome to ComputerHope!
                • Thanked: 44
                  Re: "Inventory" for HTML RPG
                  « Reply #15 on: March 22, 2006, 04:26:57 PM »
                  Instructions followed. Output is still:

                  <html>
                   <body>
                   <?php
                     // If php is running correctly, this will display "Hello world!"
                     echo '<p>Hello world!</p>';
                   ?>
                   </body>
                   </html>

                  Here's what I did:

                  Downloaded the .zip, installed it.

                  Modified the .ini file to point to Apache.

                  Set up Apache to go to C:/PHP.

                  [edit]Riiiiiiiiight. I seem to have accidentally put both recommended and the other INI file in the PHP folder and left them there. I deleted the non-recommended one, and now output is as normal. At least, no HTML is unparsed. Now all that's left is to learn how to set up variables that go outside of individual pages. If I learn how to set up multipage variables, I'll be all set. It'll make it easy to add even more new features (if I think of any. Rarely do I attempt such ambitious improvements at once.)[/edit]

                  [edit]OK, I found the 'include' function. That carries over variables... but also the whole page. I just want the variables... any way to do this?[/edit]
                  « Last Edit: March 22, 2006, 11:21:30 PM by Timothy_Bennett »
                  "The geek shall inherit the Earth."

                  Rob Pomeroy



                    Prodigy

                  • Systems Architect
                  • Thanked: 124
                    • Me
                  • Experience: Expert
                  • OS: Other
                  Re: "Inventory" for HTML RPG
                  « Reply #16 on: March 22, 2006, 11:12:15 PM »
                  Read about Sessions.
                  Only able to visit the forums sporadically, sorry.

                  Geek & Dummy - honest news, reviews and howtos

                  Dilbert

                    Topic Starter
                  • Moderator


                  • Egghead

                  • Welcome to ComputerHope!
                  • Thanked: 44
                    Re: "Inventory" for HTML RPG
                    « Reply #17 on: March 22, 2006, 11:59:17 PM »
                    Well, I'm trying, anyway. I have two pages, test1.php and test2.php. After being completely baffled by your link, I Googled "PHP Sessions" and learned... not enough, apparently. There's so many different methods people have on the web that I am a little perplexed. I tried a few things, and I'm stuck now.

                    I have the following code right now:

                    Code: [Select]
                    <!-- test1.php -->
                    <html>
                    <head>
                    <title>Test page for PHP</title>
                    </head>
                    <body>
                    <?php
                    session_start
                    ("healthmeter");
                    $_SESSION["health"] = 100;
                    echo 
                    $health;
                    ?>



                    <p><a href="test2.php">Take off 25% health</a></p>
                    </body>
                    </html>

                    Code: [Select]
                    <!-- test2.php -->
                    <html>
                    <head>
                    <title>Test page for PHP</title>
                    </head>
                    <body>
                    <?php
                    session_start
                    ()
                    $_SESSION["health"] -= 25;
                    echo 
                    $health
                    ?>


                    </body>
                    </html>

                    You can probably already see issues. My output is:

                    Quote
                    Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\test1.php:7) in C:\Program Files\Apache Group\Apache2\htdocs\test1.php on line 8

                    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Program Files\Apache Group\Apache2\htdocs\test1.php:7) in C:\Program Files\Apache Group\Apache2\htdocs\test1.php on line 8


                    Take off 25% health

                    Quote
                    Parse error: syntax error, unexpected T_VARIABLE in C:\Program Files\Apache Group\Apache2\htdocs\test2.php on line 9

                    OK, I know what a syntax error on test2.php means. I goofed, but I don't know where. Also, I have no idea what those errors are on test1.php. What am I doing wrong in my code?
                    "The geek shall inherit the Earth."

                    Rob Pomeroy



                      Prodigy

                    • Systems Architect
                    • Thanked: 124
                      • Me
                    • Experience: Expert
                    • OS: Other
                    Re: "Inventory" for HTML RPG
                    « Reply #18 on: March 23, 2006, 03:29:52 AM »
                    Okay, the first session problem is because you have already sent some output to the browser.  The session_start stuff must be at the beginning of your script; i.e. before the <html> tag.  The problems in the second script arise from you forgetting to use semicolons.  You can get away with that in javascript, but not in php.
                    Only able to visit the forums sporadically, sorry.

                    Geek & Dummy - honest news, reviews and howtos

                    Dilbert

                      Topic Starter
                    • Moderator


                    • Egghead

                    • Welcome to ComputerHope!
                    • Thanked: 44
                      Re: "Inventory" for HTML RPG
                      « Reply #19 on: March 23, 2006, 08:15:03 AM »
                      OK, I moved the entire PHP code to the top because it made no sense to see session_start outside of PHP tags, and then ehen I moved the opening PHP tag it included things like <title> and <head>. If that's wrong, let me know:

                      Code: [Select]
                      <!-- test1.php -->
                      <?php
                      session_start
                      ("healthmeter");
                      $_SESSION["health"] = 100;
                      echo 
                      $health?>

                      <html>
                      <head>
                      <title>Test page for PHP</title>
                      </head>
                      <body>

                      <p><a href="test2.php">Take off 25% health</a></p>
                      </body>
                      </html>

                      Code: [Select]
                      <!-- test2.php -->
                      <?php
                      session_start
                      ();
                      $_SESSION["health"] -= 25;
                      echo 
                      $health?>

                      <html>
                      <head>
                      <title>Test page for PHP</title>
                      </head>
                      <body>


                      </body>
                      </html>

                      OUTPUT:

                      Quote
                      Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\test1.php:2) in C:\Program Files\Apache Group\Apache2\htdocs\test1.php on line 3

                      Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Program Files\Apache Group\Apache2\htdocs\test1.php:2) in C:\Program Files\Apache Group\Apache2\htdocs\test1.php on line 3

                      Quote
                      Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\test2.php:2) in C:\Program Files\Apache Group\Apache2\htdocs\test2.php on line 3

                      Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Program Files\Apache Group\Apache2\htdocs\test2.php:2) in C:\Program Files\Apache Group\Apache2\htdocs\test2.php on line 3

                      This has to be a case of "imaboneheaditis" but it just makes little to no sense to me.
                      "The geek shall inherit the Earth."

                      Rob Pomeroy



                        Prodigy

                      • Systems Architect
                      • Thanked: 124
                        • Me
                      • Experience: Expert
                      • OS: Other
                      Re: "Inventory" for HTML RPG
                      « Reply #20 on: March 23, 2006, 01:04:13 PM »
                      Try this:

                      <?php
                      session_start("healthmeter");
                      $_SESSION["health"] = 100;
                      ?>
                      <html>
                      <head>
                      <title>Test page for PHP</title>
                      </head>
                      <body>

                      <p><a href="test2.php">Take off 25% health[/url]</p>
                      <?php
                      echo $health;
                      ?>
                      </body>
                      </html>

                      and this:
                      <?php
                      session_start();
                      $_SESSION["health"] -= 25;?>
                      <html>
                      <head>
                      <title>Test page for PHP</title>
                      </head>
                      <body>

                      <?php
                      echo $health;
                      ?>
                      </body>
                      </html>


                      In other words, ditch those comments at the start of the files, which are in fact causing output (and headers) to be sent to the browser.  ANd put the echo command within php tags in the correct place in the html.
                      Only able to visit the forums sporadically, sorry.

                      Geek & Dummy - honest news, reviews and howtos

                      Dilbert

                        Topic Starter
                      • Moderator


                      • Egghead

                      • Welcome to ComputerHope!
                      • Thanked: 44
                        Re: "Inventory" for HTML RPG
                        « Reply #21 on: March 23, 2006, 04:38:50 PM »
                        OK, I C&P'ed the code, deleting the extra lines caused by Copy and Paste ( >:() and now I don't get any error messages, but the echo command doesn't seem to be working. It doesn't show the variable. Now, I tried several methods of showing it. First, I tried enclosing it in quotes. The phrase $health appeared, but when I took out the quotes there was nothing. So, thinking it was possibly an HTML problem, I enclosed the echo PHP in <p> tags, so it read:

                        <p><?php  
                         echo $health;
                         ?> </p>

                        It stayed blank. I think it's working, I just can't see the results on the page.
                        "The geek shall inherit the Earth."

                        Rob Pomeroy



                          Prodigy

                        • Systems Architect
                        • Thanked: 124
                          • Me
                        • Experience: Expert
                        • OS: Other
                        Re: "Inventory" for HTML RPG
                        « Reply #22 on: March 24, 2006, 12:12:45 AM »
                        No sorry, of course it doesn't - I didn't pay close enough attention to your code.  The variable is $_SESSION["health"], not $health.
                        Only able to visit the forums sporadically, sorry.

                        Geek & Dummy - honest news, reviews and howtos

                        Dilbert

                          Topic Starter
                        • Moderator


                        • Egghead

                        • Welcome to ComputerHope!
                        • Thanked: 44
                          Re: "Inventory" for HTML RPG
                          « Reply #23 on: March 24, 2006, 12:23:07 AM »
                          You're on a roll. That's two major features I am now capable of implementing. Needless to say, it works perfectly.

                          Hmm... that's one of those things both of us should have caught, right? But who's made the bigger mistake: The guy that misreads a section of code or the guy that implements changes he has a nagging feeling that he just knows don't work right, then think up every conceivable solution except the one that works?

                          Whatever. It works fine now. I'd put it in my game but I'm sleepy and really should be getting to bed. (It's 11:23 PM in my time zone)
                          "The geek shall inherit the Earth."

                          Rob Pomeroy



                            Prodigy

                          • Systems Architect
                          • Thanked: 124
                            • Me
                          • Experience: Expert
                          • OS: Other
                          Re: "Inventory" for HTML RPG
                          « Reply #24 on: March 24, 2006, 02:36:12 AM »
                          Quote
                          Hmm... that's one of those things both of us should have caught, right?  But who's made the bigger mistake: The guy that misreads a section of code or the guy that implements changes he has a nagging feeling that he just knows don't work right, then think up every conceivable solution except the one that works?
                          Cheeky monkey!  In my defence, I was only debugging your specific errors, not checking your code for correct functioning. :P

                          There's one thing that you can do to improve readability - create a reference to the session variable, thus:

                          $health = &$_SESSION['health'];


                          Changes then to $health will change the session variable, so you can just use $health from that point on within the script.
                          Only able to visit the forums sporadically, sorry.

                          Geek & Dummy - honest news, reviews and howtos

                          Dilbert

                            Topic Starter
                          • Moderator


                          • Egghead

                          • Welcome to ComputerHope!
                          • Thanked: 44
                            Re: "Inventory" for HTML RPG
                            « Reply #25 on: March 24, 2006, 10:06:32 AM »
                            Quote
                            Quote
                            Hmm... that's one of those things both of us should have caught, right?  But who's made the bigger mistake: The guy that misreads a section of code or the guy that implements changes he has a nagging feeling that he just knows don't work right, then think up every conceivable solution except the one that works?
                            Cheeky monkey!  In my defence, I was only debugging your specific errors, not checking your code for correct functioning. :P

                            There's one thing that you can do to improve readability - create a reference to the session variable, thus:

                            $health = &$_SESSION['health'];


                            Changes then to $health will change the session variable, so you can just use $health from that point on within the script.

                            Actually, I was trying to show how I goofed, not you. Sorry if I mistyped, it was late, I was about to fall asleep on my desk. (It would have been a disaster to wake up with keyboard-face) Please don't take what I said the wrong way. I mean no insult. :D

                            [edit]BTW, I looked up the w3school for SQL, and it seems useful. My last database was in Access, but this looks fairly simple. Do you think it would be a good idea to use PHP for health and SQL for inventory? The idea's looknig better and better.[/edit]

                            [edit]Wait. If I used a database, then if two people were playing the game then they'd be modifying each other's inventory tables... or would they?[/edit]
                            « Last Edit: March 24, 2006, 01:18:25 PM by Timothy_Bennett »
                            "The geek shall inherit the Earth."

                            Rob Pomeroy



                              Prodigy

                            • Systems Architect
                            • Thanked: 124
                              • Me
                            • Experience: Expert
                            • OS: Other
                            Re: "Inventory" for HTML RPG
                            « Reply #26 on: March 24, 2006, 02:44:05 PM »
                            Don't worry - not offended!

                            Man, if you could learn relational databases then you would be well on the way to a significant improvement on your design.  If you go down the MySQL route, then I can provide support, but be warned: relational database design is an entirely new discipline to learn, and is not the same as programming.  I've never looked for tutorials, but you might find something useful out there.  If so, try and find something that provides MySQL examples.

                            SQL is not simpler than Access.  I think it is probably easier to get up and running with Access databases, because of all the hand-holding tools.  In fact when I started doing some serious programming, I used Access's query builders to help me construct SQL commands.  So it has its uses.  But SQL is faster by several orders of magnitude (in my non-rigourous impression...) and much more robust, and perfectly suited to large databases and multi-user environments.

                            In your final comment you refer to two users overwriting each others inventories.  No.  You have a table of users, and a table of inventories.  You use the user's ID to link to the corresponding entries in the inventory table.

                            If you install MySQL, also get hold of phpMySQLAdmin; excellent for adminstering MySQL databases in a php environment.

                            Addendum: if you get the MySQL ODBC connector, you can actually use Access as a frontend to MySQL tables.  i.e. get the power and speed on MySQL queries on the tables that are stored on your MySQL server, coupled with the ease of interface design of Access.  A veteran DB programmer told me many years ago that you should always keep your data separate from your interface.  He was right.
                            « Last Edit: March 24, 2006, 02:51:36 PM by robpomeroy »
                            Only able to visit the forums sporadically, sorry.

                            Geek & Dummy - honest news, reviews and howtos

                            Dilbert

                              Topic Starter
                            • Moderator


                            • Egghead

                            • Welcome to ComputerHope!
                            • Thanked: 44
                              Re: "Inventory" for HTML RPG
                              « Reply #27 on: March 24, 2006, 03:26:46 PM »
                              I have MySQL installed. I suppose the first thing to do is get Apache hooked up to it, right? What file should I edit, and how? I have tuts for learning MySQL but I know I need to get Apache to "see" mySQL.

                              « Last Edit: March 24, 2006, 04:16:32 PM by Timothy_Bennett »
                              "The geek shall inherit the Earth."

                              Rob Pomeroy



                                Prodigy

                              • Systems Architect
                              • Thanked: 124
                                • Me
                              • Experience: Expert
                              • OS: Other
                              Re: "Inventory" for HTML RPG
                              « Reply #28 on: March 24, 2006, 04:15:01 PM »
                              No - it's your PHP installation that needs to see MySQL, not Apache.  Not too difficult.  If MySQL is running on your server, there isn't a lot else to do.  Get phpMyAdmin (sorry mis-spelled it before) up and running and that'll make stuff easier for you.
                              Only able to visit the forums sporadically, sorry.

                              Geek & Dummy - honest news, reviews and howtos

                              Dilbert

                                Topic Starter
                              • Moderator


                              • Egghead

                              • Welcome to ComputerHope!
                              • Thanked: 44
                                Re: "Inventory" for HTML RPG
                                « Reply #29 on: March 24, 2006, 04:26:12 PM »
                                I can't find a place to d/l  phpMySQLAdmin. I swear, I've looked everywhere for it, and the only link I got - sourceforge - gave me a 500 error.

                                Oh, it's phpMyAdmin. One sec... got it. I'm setting it up... I did everything it told me to do. Now when I use MySQL it makes databases on my server. :)

                                [edit]OK, I have a small mySQL database. I couldn't figure out how to use that thing that mixes it with Access, but whatever. I like the prompt for reasons that baffle every sane person on Earth.

                                anyway, my inventory right now is thus: I have fields name, description, onHand, inInventory, and importance. I have two items entered and can add more. How can I make a web page see this? My biggest problem never has been figuring out how to do things (though that is hard sometimes); my main problem is linking it all up.[/edit]
                                « Last Edit: March 24, 2006, 06:39:48 PM by Timothy_Bennett »
                                "The geek shall inherit the Earth."

                                Rob Pomeroy



                                  Prodigy

                                • Systems Architect
                                • Thanked: 124
                                  • Me
                                • Experience: Expert
                                • OS: Other
                                Re: "Inventory" for HTML RPG
                                « Reply #30 on: March 25, 2006, 03:58:23 AM »
                                Only able to visit the forums sporadically, sorry.

                                Geek & Dummy - honest news, reviews and howtos

                                Dilbert

                                  Topic Starter
                                • Moderator


                                • Egghead

                                • Welcome to ComputerHope!
                                • Thanked: 44
                                  Re: "Inventory" for HTML RPG
                                  « Reply #31 on: March 25, 2006, 09:50:17 AM »
                                  You have my thanks. After I get this working, I'll need to know only one more thing before I can get started on the actal stories. And I'm making sure that no part of my game is "too cheesy to launch". I feel like I'm creating my own game engine; my stories'd better match! :D

                                  Anyhoo, I've set up the appropriate .dll's to get started. I'm looking at the example and I'm taking notes in a notes.txt file, and I'm making sure nothing can be forgotten.

                                  Let's see... it's called with a $link and I need host, user, and password. According to the STATUS command, my host is localhost, the user is root@localhost, and I know that my password is ********* (not actual password length (I take no chances)).

                                  Correct me if I'm wrong here or elsewhere. :)

                                  Code: [Select]
                                  echo "<table>\n";
                                  enter the <table> tag and do a line break, right?

                                  Code: [Select]
                                  // Printing results in HTML
                                  echo "<table>\n";
                                  while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
                                     echo "\t<tr>\n";
                                     foreach ($line as $col_value) {
                                         echo "\t\t<td>$col_value</td>\n";
                                     }
                                     echo "\t</tr>\n";
                                  }
                                  echo "</table>\n";

                                  Uh... echo the table, line break, and... variable "line" is whatever the column is? Then echo a table row, then print out every column in a <td>? Then echo the end of the row and go to next row until complete, right? Then end the table? I think I understand it...

                                  Code: [Select]
                                  // Free resultset
                                  mysql_free_result($result);

                                  Frees memory; I know that.

                                  Code: [Select]
                                  mysql_close($link);
                                  No need to explain that. ;)

                                  So... let's just see how well this works out...

                                  [edit]No, it didn't work. Here's my code (with password censored). Can you tell me where I goofed?

                                  Code: [Select]
                                  <?php
                                  $link 
                                  mysql_connect('localhost''root@localhost''********');
                                  or die(
                                  'Could not connect: ' mysql_error());
                                  echo 
                                  'Connected successfully';

                                  mysql_select_db('inventory') or die('Could not select database');

                                  $query 'SELECT * FROM items';
                                  $result mysql_query($query) or die('Query failed: ' mysql_error());

                                  echo 
                                  "<table>\n";
                                  while (
                                  $line mysql_fetch_array($resultMYSQL_ASSOC)) {
                                   
                                    echo "\t<tr>\n";
                                   
                                    foreach ($line as $col_value) {
                                         echo 
                                  "\t\t<td>$col_value</td>\n";
                                   
                                    }
                                   
                                    echo "\t</tr>\n";
                                  }
                                  echo 
                                  "</table>\n";

                                  mysql_free_result($result);
                                  mysql_close($link);
                                  ?>

                                  The output of that page is

                                  Quote
                                  Parse error: syntax error, unexpected T_LOGICAL_OR in C:\Program Files\Apache Group\Apache2\htdocs\test.php on line 10

                                  Where line 10 is
                                  Code: [Select]
                                  or die('Could not connect: ' . mysql_error());
                                  It has to do with my login info, doesn't it. I typed my password correctly (i just censored and changed its length in this post) but I wasn't sure about the host. I know what the user is; it told me at the prompt.

                                  And I still love the prompt for no apparent reason.[/edit]
                                  « Last Edit: March 25, 2006, 10:00:54 AM by Timothy_Bennett »
                                  "The geek shall inherit the Earth."

                                  Rob Pomeroy



                                    Prodigy

                                  • Systems Architect
                                  • Thanked: 124
                                    • Me
                                  • Experience: Expert
                                  • OS: Other
                                  Re: "Inventory" for HTML RPG
                                  « Reply #32 on: March 25, 2006, 04:00:10 PM »
                                  The problem is the semicolon at the end of the line immediately before the "or die..." line.  The "or die" is part of the same command on the previous line.  They can span two lines - that's no problem in PHP, but you must remove the semicolon.

                                  As a matter of style, I would drop out of the PHP parser when outputting straightforward HTML.  It results in code that runs more efficiently.  So your code would be more like this:

                                  Code: [Select]
                                  <?php
                                  $link 
                                  mysql_connect('localhost''root@localhost''********')
                                  or die(
                                  'Could not connect: ' mysql_error());
                                  ?>

                                  <p>Connected successfully</p>
                                  <?php
                                  mysql_select_db
                                  ('inventory') or die('Could not select database');

                                  $query 'SELECT * FROM items';
                                  $result mysql_query($query) or die('Query failed: ' mysql_error());
                                  ?>

                                  <table>
                                  <?php
                                  while ($line mysql_fetch_array($resultMYSQL_ASSOC)) {
                                  ?>

                                    <tr>
                                  <?php
                                     
                                  foreach ($line as $col_value) {
                                  ?>

                                      <td><?php echo ($col_value != '' $col_value '&nbsp;'); ?></td>
                                  <?php
                                     
                                  }
                                  ?>

                                    <tr>
                                  <?php
                                  }
                                  ?>

                                  </table>
                                  <?php
                                  mysql_free_result
                                  ($result);
                                  mysql_close($link);
                                  ?>


                                  Just to highlight one point - see my change "echo ($col_value != '' ? $col_value : '&nbsp;');"

                                  This is a conditional statement.  The bit before the question mark is evaluated.  If true, the result given is the bit before the colon; if false, the bit after.  So if $col_value isn't blank, return its value.  If it IS blank, return &nbsp; instead - an HTML non-breaking space.  If you don't do that, certain browsers will render a NULL cell, with no borders, rather than an EMPTY cell with borders.  This is a good practice to adopt when outputting data to a table cell, if you can't be sure that the data will have a printable value.
                                  « Last Edit: March 25, 2006, 04:10:29 PM by robpomeroy »
                                  Only able to visit the forums sporadically, sorry.

                                  Geek & Dummy - honest news, reviews and howtos

                                  Dilbert

                                    Topic Starter
                                  • Moderator


                                  • Egghead

                                  • Welcome to ComputerHope!
                                  • Thanked: 44
                                    Re: "Inventory" for HTML RPG
                                    « Reply #33 on: March 26, 2006, 10:12:11 AM »
                                    I copied the code and pasted it into the file. I put my password back in; my only change to the code. However, I got this error:

                                    Quote
                                    Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Group\Apache2\htdocs\test.php on line 9

                                    Line nine is

                                    Code: [Select]
                                    $link = mysql_connect('localhost', 'root@localhost', '********')
                                    "The geek shall inherit the Earth."

                                    Rob Pomeroy



                                      Prodigy

                                    • Systems Architect
                                    • Thanked: 124
                                      • Me
                                    • Experience: Expert
                                    • OS: Other
                                    Re: "Inventory" for HTML RPG
                                    « Reply #34 on: March 26, 2006, 11:07:28 PM »
                                    You need to turn on the MySQL module in the php.ini file.  Search in that file for "mysql" and you'll find it.  :)  (You'll need to restart Apache after making this change.)
                                    Only able to visit the forums sporadically, sorry.

                                    Geek & Dummy - honest news, reviews and howtos

                                    Dilbert

                                      Topic Starter
                                    • Moderator


                                    • Egghead

                                    • Welcome to ComputerHope!
                                    • Thanked: 44
                                      Re: "Inventory" for HTML RPG
                                      « Reply #35 on: March 26, 2006, 11:11:26 PM »
                                      I found a spot where MySQL had been commented out. I removed the comment and restarted Apache, but I still get the same error.
                                      "The geek shall inherit the Earth."

                                      Rob Pomeroy



                                        Prodigy

                                      • Systems Architect
                                      • Thanked: 124
                                        • Me
                                      • Experience: Expert
                                      • OS: Other
                                      Re: "Inventory" for HTML RPG
                                      « Reply #36 on: March 27, 2006, 03:58:36 AM »
                                      Okay, so you've got the line: extension=php_mysql.dll?  You can ignore the extension=php_mysqli.dll (notice the 'i') because you're unlikely to be using that.

                                      Where was the php.ini file that you edited?  In C:\Windows?  Have you rebooted since you made the change?  (Not that it should be necessary.)
                                      Only able to visit the forums sporadically, sorry.

                                      Geek & Dummy - honest news, reviews and howtos

                                      Dilbert

                                        Topic Starter
                                      • Moderator


                                      • Egghead

                                      • Welcome to ComputerHope!
                                      • Thanked: 44
                                        Re: "Inventory" for HTML RPG
                                        « Reply #37 on: March 27, 2006, 08:27:19 AM »
                                        I didn't know there was a C:\WINDOWS\iphp.ini. I'd been editing the one in C:\PHP\ini-recommended. I edited the one in C:\WINDOWS and restarted the server. Still got the same error.

                                        I'm impressed that you have this degree of patience, personally. I know I'm getting frustrated with me. ;)

                                        [edit]I made a backup of the php.ini file in C:\WINDOWS, deleted the original, coped the php.ini-reccommended in there and renamed it to php.ini. (I can always go back if I need to)

                                        And yes, I removed the comment for extension=mysql.dll. No "I" in it, I double-checked it.[/edit]
                                        « Last Edit: March 27, 2006, 08:36:11 AM by Timothy_Bennett »
                                        "The geek shall inherit the Earth."

                                        Rob Pomeroy



                                          Prodigy

                                        • Systems Architect
                                        • Thanked: 124
                                          • Me
                                        • Experience: Expert
                                        • OS: Other
                                        Re: "Inventory" for HTML RPG
                                        « Reply #38 on: March 27, 2006, 09:02:09 AM »
                                        I have just remembered another possible cause of this problem.  Under the PHP installation directory, you will find some "extension" files, which are all DLLs.  Copy them to the C:\Windows\system32 folder, and then restart Apache.  Hopefully that will be the last thing you need to do to fix this.
                                        Only able to visit the forums sporadically, sorry.

                                        Geek & Dummy - honest news, reviews and howtos

                                        Dilbert

                                          Topic Starter
                                        • Moderator


                                        • Egghead

                                        • Welcome to ComputerHope!
                                        • Thanked: 44
                                          Re: "Inventory" for HTML RPG
                                          « Reply #39 on: March 27, 2006, 09:46:39 AM »
                                          Did that, and got the same error. *tears hair out*
                                          "The geek shall inherit the Earth."

                                          Rob Pomeroy



                                            Prodigy

                                          • Systems Architect
                                          • Thanked: 124
                                            • Me
                                          • Experience: Expert
                                          • OS: Other
                                          Re: "Inventory" for HTML RPG
                                          « Reply #40 on: March 27, 2006, 01:57:56 PM »
                                          Okay, I think we've got to the point where I'd need to get my hands on your system in order to have a good look.  Knowing that your mother will never allow that ;) can you have a look in the event logs to see if they provide any illumination?
                                          Only able to visit the forums sporadically, sorry.

                                          Geek & Dummy - honest news, reviews and howtos

                                          Dilbert

                                            Topic Starter
                                          • Moderator


                                          • Egghead

                                          • Welcome to ComputerHope!
                                          • Thanked: 44
                                            Re: "Inventory" for HTML RPG
                                            « Reply #41 on: March 27, 2006, 02:20:50 PM »
                                            OK, if I knew where on the event viewer to find them. I repeated the error in hopes of finding a problem. I found a few suspects. Any of these ring a bell?

                                            Quote
                                            Faulting application mmc.exe, version 5.1.2600.2180, faulting module unknown, version 0.0.0.0, fault address 0x00000000.
                                            For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

                                            [edit]Actually, I'll PM you the other one. It may contain info I don't want public.[/edit]

                                            Quote
                                            Hanging application msimn.exe, version 6.0.2900.2180, hang module hungapp, version 0.0.0.0, hang address 0x00000000.

                                            For more information, see Help and Support Center at

                                            Quote
                                            Windows saved user TIMOTHY\Timothy registry while an application or service was still using the registry during log off. The memory used by the user's registry has not been freed. The registry will be unloaded when it is no longer in use.

                                             This is often caused by services running as a user account, try configuring the services to run in either the LocalService or NetworkService account.

                                            For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

                                            [edit]No idea if it helps, but the [MySQL] section of php.ini:

                                            [MySQL]
                                            ; Allow or prevent persistent links.
                                            mysql.allow_persistent = On

                                            ; Maximum number of persistent links.  -1 means no limit.
                                            mysql.max_persistent = -1

                                            ; Maximum number of links (persistent + non-persistent).  -1 means no limit.
                                            mysql.max_links = -1

                                            ; Default port number for mysql_connect().  If unset, mysql_connect() will use
                                            ; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
                                            ; compile-time value defined MYSQL_PORT (in that order).  Win32 will only look
                                            ; at MYSQL_PORT.
                                            mysql.default_port =

                                            ; Default socket name for local MySQL connects.  If empty, uses the built-in
                                            ; MySQL defaults.
                                            mysql.default_socket =

                                            ; Default host for mysql_connect() (doesn't apply in safe mode).
                                            mysql.default_host =

                                            ; Default user for mysql_connect() (doesn't apply in safe mode).
                                            mysql.default_user =

                                            ; Default password for mysql_connect() (doesn't apply in safe mode).
                                            ; Note that this is generally a *bad* idea to store passwords in this file.
                                            ; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password")
                                            ; and reveal this password!  And of course, any users with read access to this
                                            ; file will be able to reveal the password as well.
                                            mysql.default_password =

                                            ; Maximum time (in secondes) for connect timeout. -1 means no limit
                                            mysql.connect_timeout = 60

                                            ; Trace mode. When trace_mode is active (=On), warnings for table/index scans and
                                            ; SQL-Errors will be displayed.
                                            mysql.trace_mode = Off[/edit]
                                            « Last Edit: March 27, 2006, 03:19:46 PM by Timothy_Bennett »
                                            "The geek shall inherit the Earth."

                                            Dilbert

                                              Topic Starter
                                            • Moderator


                                            • Egghead

                                            • Welcome to ComputerHope!
                                            • Thanked: 44
                                              Re: "Inventory" for HTML RPG
                                              « Reply #42 on: March 28, 2006, 10:53:46 AM »
                                              Um... he-hello?
                                              "The geek shall inherit the Earth."

                                              Rob Pomeroy



                                                Prodigy

                                              • Systems Architect
                                              • Thanked: 124
                                                • Me
                                              • Experience: Expert
                                              • OS: Other
                                              Re: "Inventory" for HTML RPG
                                              « Reply #43 on: March 29, 2006, 07:14:17 AM »
                                              Have you definitely got an uncommented line as follows?
                                              extension=php_mysql.dll

                                              If not, does this FAQ resolve your problem?

                                              None of the errors you've posted/PMed are related to this problem, by the way.
                                              « Last Edit: March 29, 2006, 07:19:28 AM by robpomeroy »
                                              Only able to visit the forums sporadically, sorry.

                                              Geek & Dummy - honest news, reviews and howtos

                                              Dilbert

                                                Topic Starter
                                              • Moderator


                                              • Egghead

                                              • Welcome to ComputerHope!
                                              • Thanked: 44
                                                Re: "Inventory" for HTML RPG
                                                « Reply #44 on: March 29, 2006, 10:20:53 AM »
                                                Quote
                                                Have you definitely got an uncommented line as follows?
                                                extension=php_mysql.dll

                                                Yes:



                                                Quote
                                                If not, does this FAQ resolve your problem?

                                                I'm afraid not. It almost helps, but it's dealing with the actual getting of the database, etc., and I'm having trouble on the login li - that's it! The login details must be incorrect! How can I check on the host and user name?

                                                Quote
                                                None of the errors you've posted/PMed are related to this problem, by the way.

                                                 :-/
                                                "The geek shall inherit the Earth."

                                                Rob Pomeroy



                                                  Prodigy

                                                • Systems Architect
                                                • Thanked: 124
                                                  • Me
                                                • Experience: Expert
                                                • OS: Other
                                                Re: "Inventory" for HTML RPG
                                                « Reply #45 on: March 30, 2006, 12:48:14 AM »
                                                No.  The error you're reporting indicates that the mysql function library is not loaded, for some reason.  You would get a different error if you were having a DB authentication problem.

                                                I'm afraid that all I can suggest at this point is to remove PHP and reinstall, following the Win installation instructions as carefully as possible, and then repeating the steps in this thread.  Perhaps you missed something along the way?

                                                I haven't given up though and will keep thinking!
                                                Only able to visit the forums sporadically, sorry.

                                                Geek & Dummy - honest news, reviews and howtos

                                                Dilbert

                                                  Topic Starter
                                                • Moderator


                                                • Egghead

                                                • Welcome to ComputerHope!
                                                • Thanked: 44
                                                  Re: "Inventory" for HTML RPG
                                                  « Reply #46 on: March 30, 2006, 09:19:06 AM »
                                                  I am attaching screenshots of my C:\PHP and subfolders. I am also attaching copies of my php.ini and httpd.conf. Let me know if you want the Apache directories as well.

                                                  ...

                                                  apparently, I'm NOT uploading screenshots. (Stupid **** file limit) But I can upload the text files.

                                                  ...

                                                  WHAT!!! HOW CAN 26 KB EXCEED THE ****ING 250 KB LIMIT!!! AAAAAHHH!
                                                  "The geek shall inherit the Earth."

                                                  Rob Pomeroy



                                                    Prodigy

                                                  • Systems Architect
                                                  • Thanked: 124
                                                    • Me
                                                  • Experience: Expert
                                                  • OS: Other
                                                  Re: "Inventory" for HTML RPG
                                                  « Reply #47 on: March 30, 2006, 11:42:22 AM »
                                                  Drop me a line via the "contact" page of my web site; I'll email you back, then you can email screenshots etc. to me.
                                                  Only able to visit the forums sporadically, sorry.

                                                  Geek & Dummy - honest news, reviews and howtos

                                                  Dilbert

                                                    Topic Starter
                                                  • Moderator


                                                  • Egghead

                                                  • Welcome to ComputerHope!
                                                  • Thanked: 44
                                                    Re: "Inventory" for HTML RPG
                                                    « Reply #48 on: March 30, 2006, 11:46:10 AM »
                                                    Consider it done. ;D The total pics and text so far, when zipped, is about 400 KB. (I tried JPG instead of PNG, but it was even larger)

                                                    Oh, by the way, my writing QA0014 got me a job. My mother has decided SHE wants to build a site, and she needs help to do it. One of my negotiating points is that I get to put up my own site when this is done. So, after we get this problem fixed and I get the pages written, I'll finally have the green light to put this baby on the web. ;D

                                                    And I get $100 all for knowing CSS and a little JavaScript and using it.
                                                    « Last Edit: March 30, 2006, 07:37:42 PM by Timothy_Bennett »
                                                    "The geek shall inherit the Earth."

                                                    Rob Pomeroy



                                                      Prodigy

                                                    • Systems Architect
                                                    • Thanked: 124
                                                      • Me
                                                    • Experience: Expert
                                                    • OS: Other
                                                    Re: "Inventory" for HTML RPG
                                                    « Reply #49 on: March 31, 2006, 03:16:40 AM »
                                                    Quote
                                                    Consider it done.
                                                    Haven't heard from you... try PM?

                                                    Congratulations on getting the 'job'!
                                                    Only able to visit the forums sporadically, sorry.

                                                    Geek & Dummy - honest news, reviews and howtos

                                                    Dilbert

                                                      Topic Starter
                                                    • Moderator


                                                    • Egghead

                                                    • Welcome to ComputerHope!
                                                    • Thanked: 44
                                                      Re: "Inventory" for HTML RPG
                                                      « Reply #50 on: April 02, 2006, 03:13:31 PM »
                                                      Hello, rob! Excellent news! I was browsing my services list and say MySQL disabled. I set it to manual and enabled it. Well, that solved that error...

                                                      ...but now I get a different one:

                                                      Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root@localhost'@'localhost' (using password: YES) in C:\Program Files\Apache Group\Apache2\htdocs\test.php on line 9
                                                      Could not connect: Access denied for user 'root@localhost'@'localhost' (using password: YES)
                                                      "The geek shall inherit the Earth."

                                                      Rob Pomeroy



                                                        Prodigy

                                                      • Systems Architect
                                                      • Thanked: 124
                                                        • Me
                                                      • Experience: Expert
                                                      • OS: Other
                                                      Re: "Inventory" for HTML RPG
                                                      « Reply #51 on: April 03, 2006, 03:31:23 AM »
                                                      Ah.  That's somewhat easier to resolve.  :)

                                                      You should not be sending 'root@localhost'@'localhost' verification credentials.  In this case, you should be sending just 'root@localhost'.  Can you please post a code snippet of your connection attempt?  (Or refer me to it if you've already posted it.  ;) )  Blank out the password, naturally.
                                                      Only able to visit the forums sporadically, sorry.

                                                      Geek & Dummy - honest news, reviews and howtos

                                                      Dilbert

                                                        Topic Starter
                                                      • Moderator


                                                      • Egghead

                                                      • Welcome to ComputerHope!
                                                      • Thanked: 44
                                                        Re: "Inventory" for HTML RPG
                                                        « Reply #52 on: April 03, 2006, 10:02:53 AM »
                                                        Code: [Select]
                                                        $link = mysql_connect('localhost', 'root@localhost', '*******')
                                                        or die('Could not connect: ' . mysql_error());

                                                        I did that because I thought it said to log in with the host, the user, and the PW. :-/

                                                        At least, that was the idea I got from the first example here.

                                                        [edit]On a whim, I removed the @localhost from the username. I got this error:

                                                        Quote
                                                        Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'localhost' (10061) in C:\Program Files\Apache Group\Apache2\htdocs\test.php on line 9
                                                        Could not connect: Can't connect to MySQL server on 'localhost' (10061)

                                                        Putting the @localhost back in gave me the same error. :-?[/edit]
                                                        « Last Edit: April 03, 2006, 12:19:52 PM by Timothy_Bennett »
                                                        "The geek shall inherit the Earth."

                                                        Rob Pomeroy



                                                          Prodigy

                                                        • Systems Architect
                                                        • Thanked: 124
                                                          • Me
                                                        • Experience: Expert
                                                        • OS: Other
                                                        Re: "Inventory" for HTML RPG
                                                        « Reply #53 on: April 03, 2006, 01:34:44 PM »
                                                        Like I said, code snippet please.  Until I see what you're doing, I can only speculate how to fix it.
                                                        Only able to visit the forums sporadically, sorry.

                                                        Geek & Dummy - honest news, reviews and howtos

                                                        Dilbert

                                                          Topic Starter
                                                        • Moderator


                                                        • Egghead

                                                        • Welcome to ComputerHope!
                                                        • Thanked: 44
                                                          Re: "Inventory" for HTML RPG
                                                          « Reply #54 on: April 03, 2006, 01:51:24 PM »
                                                          That code at the top of my last post isn't it? The whole code for that page is

                                                          Code: [Select]
                                                          <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

                                                          <html>
                                                          <head>
                                                          <title>Untitled</title>
                                                          </head>
                                                          <body>
                                                          <?php
                                                          $link 
                                                          mysql_connect('localhost''root@localhost''******')
                                                          or die(
                                                          'Could not connect: ' mysql_error());
                                                          ?>

                                                          <p>Connected successfully</p>
                                                          <?php
                                                          mysql_select_db
                                                          ('inventory') or die('Could not select database');

                                                          $query 'SELECT * FROM items';
                                                          $result mysql_query($query) or die('Query failed: ' mysql_error());
                                                          ?>

                                                          <table>
                                                          <?php
                                                          while ($line mysql_fetch_array($resultMYSQL_ASSOC)) {
                                                          ?>

                                                            <tr>
                                                          <?php
                                                             
                                                          foreach ($line as $col_value) {
                                                          ?>

                                                              <td><?php echo ($col_value != '' $col_value '&nbsp;'); ?></td>
                                                          <?php
                                                             
                                                          }
                                                          ?>

                                                            <tr>
                                                          <?php
                                                          }
                                                          ?>

                                                          </table>
                                                          <?php
                                                          mysql_free_result
                                                          ($result);
                                                          mysql_close($link);
                                                          ?>

                                                          </body>
                                                          </html>
                                                          "The geek shall inherit the Earth."

                                                          Rob Pomeroy



                                                            Prodigy

                                                          • Systems Architect
                                                          • Thanked: 124
                                                            • Me
                                                          • Experience: Expert
                                                          • OS: Other
                                                          Re: "Inventory" for HTML RPG
                                                          « Reply #55 on: April 04, 2006, 02:48:10 AM »
                                                          I'm so sorry - I've no idea how I missed that before!

                                                          Right, now your connection syntax should be as follows:
                                                          $link = mysql_connect('localhost', 'root', '********') or die ('Could not connect: ' . mysql_error());

                                                          i.e. leave out the '@localhost" bit.

                                                          MySQL permissions are specific to the host from which you're connectiing (and this is detected automatically), so you can only connect from localhost as root, if you have already given yourself this permission.  The error you're seeing could be due to a permissions error, or it could be due to a non-listening MySQL server.

                                                          Double-check that the MySQL server is running.  I'm assuming you didn't change the default port when you installed it.  Ensure that your firewall is not blocking connections on that port (3306).

                                                          The MySQL installation on Windows comes with some GUI clients; you can try using them to connect to the server.  You can also try the tests on this page.  I recommend bookmarking the MySQL reference pages, if you haven't already done so.  I refer to them all the time.

                                                          Report back, and do bear with me if I appear to be blind or stupid...  :-[
                                                          Only able to visit the forums sporadically, sorry.

                                                          Geek & Dummy - honest news, reviews and howtos

                                                          Dilbert

                                                            Topic Starter
                                                          • Moderator


                                                          • Egghead

                                                          • Welcome to ComputerHope!
                                                          • Thanked: 44
                                                            Re: "Inventory" for HTML RPG
                                                            « Reply #56 on: April 04, 2006, 08:15:35 AM »
                                                            Hey, missing a piece of a post is a common, everyday mistake. I do it all the time, as is evident with my Linux thread. The line

                                                            Quote
                                                            do bear with me if I appear to be blind or stupid...

                                                            Ought to be coming from me! ;)

                                                            I'll do this after school, but right now I'm just checking the forums and modifying my mental "to do list".

                                                            Or am I just mental?
                                                            « Last Edit: April 04, 2006, 08:17:52 AM by Timothy_Bennett »
                                                            "The geek shall inherit the Earth."