-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

If you want to add that value only when the user has logged in, you should put that line of code right after the username / password validation (if the validation has been successfull) since the login code is something you just do once.

于 2012-05-20T11:40:08.737 に答える