nitation Posted June 26, 2008 Author Share Posted June 26, 2008 This is the form.php <?php session_start(); if (!isset ($_SESSION["afso_userid"])) { header ("Location:main.php?login=missing"); } include("connect.php"); if($log){ $sqllog=mysql_query(" SELECT * FROM register_account WHERE account_number='$account_number' AND account_key='$account_key' AND status='1' "); $sqllog=mysql_query("UPDATE register_account SET lastlogin= '$lastlogin' where id='$id'"); if($sqllog){ $row=mysql_fetch_array($sqllog); $rowid=$row["id"]; } $num=mysql_num_rows($sqllog); if($num > 0){ $_SESSION["afso_userid"]=$row["id"]; header ("Location: index.php"); } else { header ("Location: main.php?login=wrong"); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/111832-kindly-check-it-out/page/2/#findComment-575372 Share on other sites More sharing options...
Aeglos Posted June 26, 2008 Share Posted June 26, 2008 Form variables don't just automagically apear by id name in your code, they are all wrapped inside the $_POST array, which you have referenced nowhere, that's why all your variables are empty. Also you are still inmediatly overwritting your SELECT statement with your UPDATE statement, effectively making the SELECT by account and password completely useless. Quote Link to comment https://forums.phpfreaks.com/topic/111832-kindly-check-it-out/page/2/#findComment-575408 Share on other sites More sharing options...
nitation Posted June 26, 2008 Author Share Posted June 26, 2008 Cool. In a situation like this, how do i update the last login of a specific user? I have also noted that overwriting a select statement will do my program no good. How do i solve my problem. Can someone give me a sample code??? Quote Link to comment https://forums.phpfreaks.com/topic/111832-kindly-check-it-out/page/2/#findComment-575504 Share on other sites More sharing options...
dannyb785 Posted June 27, 2008 Share Posted June 27, 2008 Cool. In a situation like this, how do i update the last login of a specific user? I have also noted that overwriting a select statement will do my program no good. How do i solve my problem. Can someone give me a sample code??? In my page, to update the user's last login I do this: <?php // once the login has been verified and mysql_fetch_array has been executed $id = $row['user_id']; $now = strtotime("now"); $result = mysql_query("UPDATE User SET user_last_login='$now' WHERE user_id='$id' ") or die(mysql_error()); that's all you really need Quote Link to comment https://forums.phpfreaks.com/topic/111832-kindly-check-it-out/page/2/#findComment-575646 Share on other sites More sharing options...
Rowno Posted June 27, 2008 Share Posted June 27, 2008 Did you even try the code I gave you? Don't see why you were complaining about getting no sample code from anyone... Quote Link to comment https://forums.phpfreaks.com/topic/111832-kindly-check-it-out/page/2/#findComment-575734 Share on other sites More sharing options...
dannyb785 Posted June 27, 2008 Share Posted June 27, 2008 Did you even try the code I gave you? Don't see why you were complaining about getting no sample code from anyone... I suffer the same epidemic. People ask for code and when its given, they say "why doesnt anyone help me?" or they try one suggestion of the 5 given and say that it doesnt work and that nobody here knows what theyre talking about. Quote Link to comment https://forums.phpfreaks.com/topic/111832-kindly-check-it-out/page/2/#findComment-576152 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.