如何通过单击ID显示mysql表的值

问题描述 投票:0回答:1

先生/妈妈我想通过单击网页中提供的任何ID来显示和更新mysql表

示例我在类似[]的php网页中有一个表

项目代码-描述-数量-估计

phk1 abcd 2 1111

我需要的是如何通过单击项目代码(phk1)显示和更新表。请帮助

先生/妈妈,我想通过单击网页中给出的任何ID显示和更新mysql表的示例我在php网页中有一个表,如Itemcode-Description-- Qty--估计phk1 abcd 2 ...] >

php mysql edit show
1个回答
0
投票

考虑到您正在显示这样的记录。

<?php

$link = mysqli_connect("localhost", "root", "", "my_db");

// Check connection
if($link === false){
    die("ERROR: Could not connect. " . mysqli_connect_error());
}

else
{
    echo "connection successfully";
}

$sql = "SELECT Id, Email, FirstName, LastName, Password FROM signup";

$result = $link->query($sql);
?>

<table>
    <tr>
<td style="margin-right: 30px;">ID</td>
            <td style="margin-right: 30px;">Email</td>
            <td>First Name</td>
            <td>Last Name</td>
            <td>Password</td>
    </tr>
<?php

if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
        ?>
        <tr>

         echo '<td><a href="update.php?id=' . $row['id'] . '">' . $row['id'] . '</a></td>';
© www.soinside.com 2019 - 2024. All rights reserved.