这是我的第一篇文章,所以请耐心等待我在这里输入代码。我试图将一些图像输出到 PDF,并且需要创建一个 if 语句来连续查找数据。
$connection = mysql_connect("localhost", "testdb", "********")
or die ("Unable to connect!");
// select database
mysql_select_db("testdb") or die ("Unable to select database!");
// Select all the rows in the test table
$query = "SELECT * FROM test2 WHERE testid=89";
$result = mysql_query($query);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
while ($row= mysql_fetch_array($result)) {
$image = $row[1];
$text = $row[2];
}
这就是我到目前为止所拥有的,基本上我需要一些类似的东西:
If (data in row 1) {
print $image;
} else {
print $text;
}