這是我的第一篇文章,所以請將代碼輸入到這裏。我試圖輸出一些圖像到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;
}
貴表包含哪些數據? – Vamsi 2012-08-08 11:59:33
只是從表單輸入的文本和圖像路徑 – Josh 2012-08-08 12:26:55