这是我的PHP代码,我目前正在使用。
<?php
$servername = "localhost";
$username = "user";
$password = "123";
$dbname = "db";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT fontsize FROM fb_test WHERE id = 15 ";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo $row["fontsize"];
}
} else {
echo "0 results";
}
$conn->close();
?>
<?php
$servername = "localhost";
$username = "user";
$password = "123";
$dbname = "db";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT fontsize FROM fb_test WHERE id = 15 ";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo $row["fontsize"];
}
} else {
echo "0 results";
}
$conn->close();
?>
我想做这样的事
有人可以帮我这样做吗?如果有人知道帮助我,我试过everthing但不工作$var = echo $row["fontsize"];
....
....
imagettftext($this->fond,$var,0,200,400,$textcolor,$font,$item_text);
答案 0 :(得分:1)
$ var = $ row [“fontsize”];
imagettftext($这 - &GT;喜欢,$变种,0200400,$文本颜色,字体$,$ ITEM_TEXT);
回显才有用。