ItsNotRudy
11-02-2009, 04:19 AM
Hey,
I am making a signature service for a group of peers where they will put
www.mydomain.com/sig.php?id=1[img] in their signature. The id=1 is supposed to fetch the information for the row where id=1, displaying the fields associated.
Here's the code:
<?
$db_host = "localhost";
$db_user = "signatures";
$db_pass = "******";
$db_name = "signatures";
$db = mysql_connect($db_host,$db_user,$db_pass);
mysql_select_db ($db_name) or die ("Cannot Connect To Database");
$id = $_GET['id'];
$query = 'SELECT `name` FROM `information` WHERE id = '$id''
$result = mysql_query($query);
header("Content-type: image/gif");
$im = imagecreatefromgif("sig.gif");
$color = imagecolorallocate($im, 0, 0, 0);
imagestring($im, 5, 200, 1, $result, $color);
imagegif($im);
imagedestroy($im);
?>
The issue seems to be here, but ofcourse I am not totally sure.
$query = 'SELECT `name` FROM `information` WHERE id = '$id''
$result = mysql_query($query);
I've tried like 10 different queries, no ', slashes and whatnot. No result, different weird messages printed on my picture ("Resource ID #2" and "Array"). They all output junk I can't use. What I need is for it to output the "name" field associated to id 1 in the database if I type www.yourdomain.com/sig.php?id=1
If you wish to try out the code, try using this image for optimal testing since that's my planned size:
[IMG]http://downloads.zero-sum.nl/signatures/gifsig/sig.gif
Oh btw, rendering the ID number received by the GET is properly onto the picture when I put the variable in the imagestring.
I am making a signature service for a group of peers where they will put
www.mydomain.com/sig.php?id=1[img] in their signature. The id=1 is supposed to fetch the information for the row where id=1, displaying the fields associated.
Here's the code:
<?
$db_host = "localhost";
$db_user = "signatures";
$db_pass = "******";
$db_name = "signatures";
$db = mysql_connect($db_host,$db_user,$db_pass);
mysql_select_db ($db_name) or die ("Cannot Connect To Database");
$id = $_GET['id'];
$query = 'SELECT `name` FROM `information` WHERE id = '$id''
$result = mysql_query($query);
header("Content-type: image/gif");
$im = imagecreatefromgif("sig.gif");
$color = imagecolorallocate($im, 0, 0, 0);
imagestring($im, 5, 200, 1, $result, $color);
imagegif($im);
imagedestroy($im);
?>
The issue seems to be here, but ofcourse I am not totally sure.
$query = 'SELECT `name` FROM `information` WHERE id = '$id''
$result = mysql_query($query);
I've tried like 10 different queries, no ', slashes and whatnot. No result, different weird messages printed on my picture ("Resource ID #2" and "Array"). They all output junk I can't use. What I need is for it to output the "name" field associated to id 1 in the database if I type www.yourdomain.com/sig.php?id=1
If you wish to try out the code, try using this image for optimal testing since that's my planned size:
[IMG]http://downloads.zero-sum.nl/signatures/gifsig/sig.gif
Oh btw, rendering the ID number received by the GET is properly onto the picture when I put the variable in the imagestring.