我正在尝试使用imagestring在foreach循环中添加一个新行,但它会在同一行上显示信息 这是图像,你可以看到我不需要指出的错误 Image Link
<?php
if (count($rows) == 0) {
imagestring($image, $fontsize, $leftside, 90, "NO JOBS DETECTED", $font_white);
}
foreach($rows as $key=>$row) {
$query = "
SELECT username FROM users";
$query_params = array(':id' => $row['driver']);
$query .= "WHERE id = :id";
try {
$stmt = $db->prepare($query);
$result = $stmt->execute($query_params);
} catch(PDOException $ex) {
die("Failed to run query: " . $ex->getMessage());
}
$driver = $stmt->fetch();
$driver = $driver['username'];
imagestring($image, $fontsize, $leftside, 100, "Top 5 Drivers", $font_red);
imagestring($image, $fontsize, $leftside, $linedown, ($key+1).'..' . $driver, $font_red);
}