By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,278 Members | 1,358 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,278 IT Pros & Developers. It's quick & easy.

multi image print

The1corrupted
100+
P: 134
I'm having issues with my own multi-image print...

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

if ($simg == 0) { $simg="sfalse.gif";
} else { $simg="strue.gif"; }

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

if ($wimg == 0) { $wimg="wfalse.gif";
} else { $wimg="wtrue.gif"; }

if ($uimg == 0) { $uimg="ufalse.gif";
} else { $uimg="utrue.gif"; }

if ($dimg == 0) { $dimg="dfalse.gif";
} else { $dimg="dtrue.gif"; }
[/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]
Feb 20 '07 #1
Share this Question
Share on Google+
11 Replies


Motoma
Expert 2.5K+
P: 3,235
I have split this thread. You will receive better responses this way.
Feb 20 '07 #2

Motoma
Expert 2.5K+
P: 3,235
What exactly is the issue you are having?
Feb 20 '07 #3

The1corrupted
100+
P: 134
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_query("SELECT *
FROM rooms
WHERE ns='$x'
AND ew='$y'
AND ud='$z'");
$ray=mysql_fetch_array($summon);

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

Motoma
Expert 2.5K+
P: 3,235
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_query("SELECT *
FROM rooms
WHERE ns='$x'
AND ew='$y'
AND ud='$z'");
$ray=mysql_fetch_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.
Feb 20 '07 #5

The1corrupted
100+
P: 134
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.
Feb 20 '07 #6

The1corrupted
100+
P: 134
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]
Feb 20 '07 #7

Motoma
Expert 2.5K+
P: 3,235
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.
Feb 20 '07 #8

The1corrupted
100+
P: 134
Actually, they should, but the first one didn't and it managed to completely break my coordinate system...
Feb 20 '07 #9

Motoma
Expert 2.5K+
P: 3,235
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.
Feb 20 '07 #10

The1corrupted
100+
P: 134
Gah! So you're right... Thanks for catching that error.
Feb 20 '07 #11

Motoma
Expert 2.5K+
P: 3,235
Gah! So you're right... Thanks for catching that error.
Glad to help.
Feb 20 '07 #12

Post your reply

Sign in to post your reply or Sign up for a free account.