prepare("SELECT name, pop FROM nations where name = ? or name = 'United States' or name = 'Mexico'"); if ($stmt->execute(array($_REQUEST['nation']))) { $num = 0; while ($ans = $stmt->fetch()) { #print_r($ans); $num++; ImageFilledRectangle($image, $num * 100, 500-$ans['pop']/1000000, 100*$num+98, 500, $red); ImageString($image, 5, $num*100, 530, $ans['name'], $red); #echo ($ans[0]/1000000 . $ans[1] . "
"); } } } catch (Exception $e) { print "Error!: " . $e->getMessage() . "
"; die(); } ImagePNG($image); ?>