bcode Posted February 6, 2010 Share Posted February 6, 2010 I am getting Warning:mysql_fetch_assoc():supplied argument is not valid. I am confused because I double checked the table names and made sure the rows were correct but can't get it to work. if(!empty($_POST['password'])) { $userName = $_POST['name']; $password = $_POST['password']; $userNameClean = mysql_real_escape_string($userName); $passwordClean = mysql_real_escape_string($password); $userIP = $_SERVER['REMOTE_ADDR']; $sql = "SELECT * FROM usersTable WHERE userName='$userNameClean' AND userPassword='$passwordClean'"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); $id = $row['id']; if($id > 0) { $set = "UPDATE usersTable SET userActivity = 'online', userIP = '$userIP' "; $set .= "WHERE id = '$id'"; mysql_query($set); header('Location: index.php'); }else{ $loginstatus = 'Invalid email and/or password.'; } } Link to comment https://forums.phpfreaks.com/topic/191186-a-warning-problem/ Share on other sites More sharing options...
wildteen88 Posted February 6, 2010 Share Posted February 6, 2010 Your query is most likely failing due to an error. Use mysql_error find out why. $result = mysql_query($sql) or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/191186-a-warning-problem/#findComment-1008045 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.