0
我有一個數據庫,有很多列,我必須創建一個鏈接來查看更多。PHP/MySQL如何從新窗口顯示數據庫行?
如何打印我當前的數據庫的示例。
row 1 | c1 | c2 | c3 | ... | c(n-m)| '查看更多'
row 2 | c1 | c2 | c3 | ... | c(n-m)| 「查看更多」
這裏是我的代碼:
while($row = $result->fetch_array()){ //creates a loop to loop through results
echo "<tr><td>"; //start a row and cell tag in HTML
for($i=0;$i<12;$i++){ //Creates a loop to print the results
if($i == 1){ //concatenates the names
echo $row[$search_value[$i + 1]] . " " . $row[$search_value[$i + 2]] . " " . $row[$search_value[$i]] . "</td><td>";
$i = $i + 2; //skips the next two since its already printed
} else if($i == 5){ //concatenates the addresses
echo $row[$search_value[$i]] . ", " . $row[$search_value[$i + 1]] . ", " . $row[$search_value[$i + 2]] . "</td><td>";
$i = $i + 2; //skips the next two since its already printed
} else {
echo $row[$search_value[$i]] . "</td><td>"; //prints the specified value and the end and start of a table cell
}
}
echo "<a href='view_more.php' target='_blank'>View More</a>";
echo "</tr></td>"; //ends a row and cell tag in HTML
}
現在實際上,我怎麼打印出特定行的數據的休息嗎? (當我點擊第1行的'查看更多'時,如何顯示第1行的其餘數據?)
我打算將鏈接傳遞給一個唯一的值,然後再次搜索在那個新的頁面中,只是打印它。但是,再次,「我該怎麼做?」。
謝謝你!我會稍後再嘗試 – 2014-10-27 09:37:39