使用語法:PHP、SQL、HTML
範例說明:將資料庫的資料取出來之後,放入指定的欄數裡面,通常抓取的資料會以縱向向下排列,
此範例使用簡單的寫法讓資料乖乖橫向排列。
Test.php
mysql_select_db($database_test, $test);
$query_record = "SELECT name FROM recordfile";
$record = mysql_query($query_record, $test) or die(mysql_error());
$row_record = mysql_fetch_assoc($record);
$totalRows = mysql_num_rows($record);
?>
$query_record = "SELECT name FROM recordfile";
$record = mysql_query($query_record, $test) or die(mysql_error());
$row_record = mysql_fetch_assoc($record);
$totalRows = mysql_num_rows($record);
?>
'.$row_record['name'].' | ';'.$row_record['name'].' | ';'.$row_record['name'].' |
顯示結果如下圖: