multi image print

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • The1corrupted
    New Member
    • Feb 2007
    • 134

    #1

    multi image print

    I'm having issues with my own multi-image print...

    [PHP]//Ifs that make the correct image...
    if ($nimg == 0) { $nimg="nfalse.g if";
    } else { $nimg="ntrue.gi f"; }

    if ($simg == 0) { $simg="sfalse.g if";
    } else { $simg="strue.gi f"; }

    if ($eimg == 0) { $eimg="efalse.g if";
    } else { $eimg="<etrue.g if"; }

    if ($wimg == 0) { $wimg="wfalse.g if";
    } else { $wimg="wtrue.gi f"; }

    if ($uimg == 0) { $uimg="ufalse.g if";
    } else { $uimg="utrue.gi f"; }

    if ($dimg == 0) { $dimg="dfalse.g if";
    } else { $dimg="dtrue.gi f"; }
    [/PHP]

    Then I try to embed the image names...

    [PHP]
    echo " <table border='0' align='center' cellspacing='0' >
    <tr><td><img src='images/blank.gif'></td><td><img src='images/".$nimg."'> </td><td><img src='images/".$uimg."'> </td></tr>
    <tr><td><img src='images/".$wimg."'> </td><td><img src='images/blank.gif'></td><td><img src='images/".$eimg."'> </td></tr>
    <tr><td><img src='images/".$dimg."'> </td><td><img src='images/".$simg."'> </td><td><img src='images/blank.gif'></td></tr>";
    [/PHP]
  • Motoma
    Recognized Expert Specialist
    • Jan 2007
    • 3236

    #2
    I have split this thread. You will receive better responses this way.

    Comment

    • Motoma
      Recognized Expert Specialist
      • Jan 2007
      • 3236

      #3
      What exactly is the issue you are having?

      Comment

      • The1corrupted
        New Member
        • Feb 2007
        • 134

        #4
        This has been the result of two things breaking at once... When I try to echo out the images, it all goes to one side or the other rather than actually comparing it to the table... Also, it breaks my session variables and they hence don't change where as normally they would..

        Basically, I suspect this might not be working:

        [PHP]$x=$_SESSION['xcoord'];
        $y=$_SESSION['ycoord'];
        $z=$_SESSION['zcoord'];

        $summon=mysql_q uery("SELECT *
        FROM rooms
        WHERE ns='$x'
        AND ew='$y'
        AND ud='$z'");
        $ray=mysql_fetc h_array($summon );

        $nimg=$ray[3];
        $simg=$ray[4];
        $eimg=$ray[5];
        $wimg=$ray[6];
        $uimg=$ray[7];
        $dimg=$ray[8];[/PHP]

        Comment

        • Motoma
          Recognized Expert Specialist
          • Jan 2007
          • 3236

          #5
          Originally posted by The1corrupted
          This has been the result of two things breaking at once... When I try to echo out the images, it all goes to one side or the other rather than actually comparing it to the table... Also, it breaks my session variables and they hence don't change where as normally they would..

          Basically, I suspect this might not be working:

          [PHP]$x=$_SESSION['xcoord'];
          $y=$_SESSION['ycoord'];
          $z=$_SESSION['zcoord'];

          $summon=mysql_q uery("SELECT *
          FROM rooms
          WHERE ns='$x'
          AND ew='$y'
          AND ud='$z'");
          $ray=mysql_fetc h_array($summon );

          $nimg=$ray[3];
          $simg=$ray[4];
          $eimg=$ray[5];
          $wimg=$ray[6];
          $uimg=$ray[7];
          $dimg=$ray[8];[/PHP]
          Are your coordinates in the database as VARCHAR, INT, or FLOAT?
          You might not want to have them in 's if they aren't VARCHAR.

          Comment

          • The1corrupted
            New Member
            • Feb 2007
            • 134

            #6
            I've just narrowed it down. That entire section in the first post is all bad. The coords are actually TINYINTs and are up to three digits long... Sorry for the mistake.

            Comment

            • The1corrupted
              New Member
              • Feb 2007
              • 134

              #7
              Okay, nevermind. I totally fixed it. With this little snippet of code..

              [PHP]
              if ($ray[3] == 0) { echo "<div style='position :absolute; top:100; left:480; z-index:1;'>
              <img src='images/ntrue.gif' height='30px' width='30px'>
              </div>";
              } elseif ($ray[3] == 1) { echo "<div style='position :absolute; top:100; left:480; z-index:1;'>
              <img src='images/ntrue.gif' height='30px' width='30px'>
              </div>";[/PHP]

              Comment

              • Motoma
                Recognized Expert Specialist
                • Jan 2007
                • 3236

                #8
                Originally posted by The1corrupted
                Okay, nevermind. I totally fixed it. With this little snippet of code..

                [PHP]
                if ($ray[3] == 0) { echo "<div style='position :absolute; top:100; left:480; z-index:1;'>
                <img src='images/ntrue.gif' height='30px' width='30px'>
                </div>";
                } elseif ($ray[3] == 1) { echo "<div style='position :absolute; top:100; left:480; z-index:1;'>
                <img src='images/ntrue.gif' height='30px' width='30px'>
                </div>";[/PHP]
                Heads up: both cases show the same image.

                Comment

                • The1corrupted
                  New Member
                  • Feb 2007
                  • 134

                  #9
                  Actually, they should, but the first one didn't and it managed to completely break my coordinate system...

                  Comment

                  • Motoma
                    Recognized Expert Specialist
                    • Jan 2007
                    • 3236

                    #10
                    I mean, line by line these are the same thing:

                    <div style='position :absolute; top:100; left:480; z-index:1;'>
                    <img src='images/ntrue.gif' height='30px' width='30px'>
                    </div>

                    <div style='position :absolute; top:100; left:480; z-index:1;'>
                    <img src='images/ntrue.gif' height='30px' width='30px'>
                    </div>

                    You don't need the if statement.

                    Comment

                    • The1corrupted
                      New Member
                      • Feb 2007
                      • 134

                      #11
                      Gah! So you're right... Thanks for catching that error.

                      Comment

                      • Motoma
                        Recognized Expert Specialist
                        • Jan 2007
                        • 3236

                        #12
                        Originally posted by The1corrupted
                        Gah! So you're right... Thanks for catching that error.
                        Glad to help.

                        Comment

                        Working...