I'm trying to display generated images produced from the same file but each image is slightly different. The php that produces the image references a database and plots dots where there are locations in the database. The locations all have a type assigned and I'm trying to plot those with type one on one plot and those with type two on another plot. So far I have tried using sessions, but both images seem to be generated using the second value, in this case 2.
$_SESSION['type']=1;
?>
<IMG SRC="imgtest3.php">
<?php
$_SESSION['type']=2;
?>
<IMG SRC="imgtest3.php">
<br>
<?php
I tried putting a static variable in imgtest3.php but that didn't seem to do anything useful.
Now I'm trying
?>
<IMG SRC="imgtest3.php?type=1">
<IMG SRC="imgtest3.php?type=2">
<br>
<?php
Which seems to plot the dots in the correct locations but it wrecks the background image. The background should be white but if I do this it becomes almost all black and shows some sort of interference pattern at the top of the image. What am I doing wrong? Thanks.
<?php
//ini_set("display_errors", "On");
echo("this is text before the picture <br>");
?>
<IMG SRC="imgtest3.php?type=2">
<IMG SRC="imgtest3.php?type=2">
<br>
<?php
echo("this is text after the picture");
?>
imgtest3.php
<?php
//start of main
header("Content-type: text/html");
//ini_set("display_errors", "On");
$link = @mysql_connect('localhost', 'rob', 'mypass') or die("Could not connect to MySQL");
$db = @mysql_select_db('temp2',$link) or die("Could not select database");
$type=$_GET['type'];
$image=drawimage($link,$type);
imagepng($image);
//end of main
function drawimage($link,$i)
{
$image = imagecreatefromgif("map.gif");
$query = "SELECT * FROM table2ll WHERE status=1 AND type=".$i; //select green sites
$result = @mysql_query($query,$link) or die("Could not submit query1");
makedots($image, $result, 1);
$query = "SELECT * FROM table2ll WHERE status=2 AND type=".$i;//select red sites
$result = @mysql_query($query,$link) or die("Could not submit query");
makedots($image, $result,2);
$query = "SELECT * FROM table2ll WHERE status=3 AND type=".$i;//select clear sites
$result = @mysql_query($query,$link) or die("Could not submit query");
makedots($image, $result,3);
return($image);
}
?>
The makedots function works correctly, I've tested it independently and it worked on previous steps.