PHP/MySQL如何从新窗口显示数据库行?

PHP/MySQL如何从新窗口显示数据库行?,php,mysql,Php,Mysql,我有一个数据库,它有很多列,我必须创建一个链接来查看更多的列 如何打印当前数据库的示例 第1排| c1 | c2 | c3 |……|c(n-m)|“查看更多” 第2排| c1 | c2 | c3 |……|c(n-m)|“查看更多” 这是我的代码: while($row = $result->fetch_array()){ //creates a loop to loop through results echo "<tr><td>"; //start a

我有一个数据库,它有很多列,我必须创建一个链接来查看更多的列

如何打印当前数据库的示例

第1排| c1 | c2 | c3 |……|c(n-m)|“查看更多”

第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

}
while($row=$result->fetch_array()){//创建一个循环来循环结果
echo”“;//在HTML中启动行和单元格标记

对于($i=0;$i),可以在$\u GET中传递该值:

 $pk = $row['primary_key'];
 echo "<a href='view_more.php?row_id=$pk' target='_blank'>View More</a>";
但是如果你要使用ajax,你必须把它移动到一个post或funciton。
并通过传递该行的id(或该行的id)使用相同的方法。

谢谢!我稍后再试
 SLECT .... WHERE primary_key=$_GET['row_id'].