PHP查询表中的行

时间:2019-05-28 11:55:41

标签: php mysql

我对此代码在php中有问题,特别是我是一个初学者..我想从该行中获取值(这些行在搜索后出现,因此可能有多个行),您可以在其中单击在按钮上发送并将这些值放在另一个表中,只是不要输入这些值..我附上示例代码。对不起,我的英语

<form action="request.php" method="POST">
    <tr>
        <th scope="row">' . $_idactivity . '</th>
        <td>' . $_name . '</td>
        <td>' . $_place . '</td>
        <td>' . $_language . '</td>
        <td>' . $_date . '</td>
        <td>' . $_time . '</td>
        <td>' . $_cost . '€</td>
        <td>' . $_description. '</td>
        <td> <input class="btn btn-primary" type="submit" name"submit" value="Send request"></td>
    </tr> 
</form>';

请求

<?php 
    session_start();
    include('../../Database/conn.php');
    $sql = "SELECT * FROM activity";
    $r_query = mysqli_query($cn, $sql);

    while ($row = mysqli_fetch_array($r_query)) {
        $_idactivity = $row['id_attivita'];
        $_idrich = $_SESSION['id'];
    }

    $insert = "INSERT INTO request 
                            (activity_id,id_rich,state) 
                    VALUES ("
                              . "'" . $_idactivity .    "',"
                              . "'" . $_idrich .    "',1)";
    if($insert){   
        echo 'request send';
    }

0 个答案:

没有答案