-1

如何仅在登录时插入transuser表login_time和userId,我不想在刷新页面时添加它

<table border=1>
    <tr>
        <td>User name</td>
        <td>Password</td>
        <td>Home Page</td>
    </tr>
    <tr>
    <?
        $date=date('Y/m/d H:i',time());
        $selUser=mysql_query("SELECT * FROM train_user where user_name='$user' ");
        while ($rowUser=mysql_fetch_array($selUser)){
    ?>
        <td><a href=""><?echo $rowUser['user_name'];?></a></td>
        <td><?echo $rowUser['user_password'];?></td>
        <td><?echo $rowUser['user_homepage'];?></td>
    </tr>
    </table>
    <?}
    mysql_query("INSERT INTO train_transuser (transuser_userId,transUser_loginTime) VALUES ('$user','$date')");
    ?>
4

1 回答 1

0

如果您只想在用户登录时添加该值,您应该将该行代码放在用户名/密码验证之后(如果验证已成功),因为登录代码是您只需执行一次的操作。

于 2012-05-20T11:40:08.737 回答