u214 Posted April 30, 2011 Share Posted April 30, 2011 Hello guys. I'm kinda new to PHP, I've been understanding everything so far. I have trouble with "imagestring" What I want is to query a row in MySQL. I want to display some of that info in the image. It's not working properly. Here's the code: <?php $imagepath="css/images/dog.jpg"; $image=imagecreatefromjpeg($imagepath); $imgheight=imagesy($image); $color=imagecolorallocate($image, 255, 255, 255); include("config.php"); $result = mysql_query("SELECT * FROM playerinfo WHERE Level > 0 ORDER BY Level DESC", $connect); while($myrow = mysql_fetch_row($result)) { // Not working properly. imagestring($image, 5, 50, $imgheight-50, $myrow[0], $color); } // This line works like it should: //imagestring($image, 5, 50, $imgheight-50, "Using it like this works!", $color); header('Content-Type: image/jpeg'); imagejpeg($image); ?> Any help will be GREATLY appreciated it. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/235207-creating-dynamic-images/ Share on other sites More sharing options...
fugix Posted April 30, 2011 Share Posted April 30, 2011 what errors do you receive...if you echo $myrow[0]; what do you get? Quote Link to comment https://forums.phpfreaks.com/topic/235207-creating-dynamic-images/#findComment-1208725 Share on other sites More sharing options...
u214 Posted April 30, 2011 Author Share Posted April 30, 2011 I found the problem. It was a silly mistake. When requiring the string, it was to display ALL the info that it found with "Level" greater than 0. So everything was just displaying on top of each other, making the text un-readable. I changed it to: SELECT * FROM playerinfo WHERE user = 'test' And it gave just what I wanted. Quote Link to comment https://forums.phpfreaks.com/topic/235207-creating-dynamic-images/#findComment-1208729 Share on other sites More sharing options...
fugix Posted April 30, 2011 Share Posted April 30, 2011 glad you settled it out Quote Link to comment https://forums.phpfreaks.com/topic/235207-creating-dynamic-images/#findComment-1208735 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.