I need help with my code. I get the message "The image “http://agent-penguin.net/pets/img.php?id=1” cannot be displayed, because it contains errors." When I try it out.
<?php
header("Content-type: image/png");
$id=$_GET['id'];
$username="[i]You don't need to see this[/i]";
$password="[i]pretty password[/i]";
$database="agentpe_pet";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die();
$query1="SELECT * FROM pets WHERE id='$id'";
$result1=mysql_query($query1);
mysql_close();
$hugs=mysql_result($result1,"hugs");
$type=mysql_result($result1,"type");
$itype="$type.png";
$ihugs="Hugs $hugs";
$im=imagecreatefrompng($itype);
$orange=imagecolorallocate($im, 220, 210, 60);
imagestring($im, 3, 7, 9,$ihugs, $orange);
imagepng($im);
imagedestroy($im);
?>
I want it to display the ammount of hugs on the image. right now it displays the ID only. ( http://agent-penguin.net/pets/img3.php?id=1 )