Jump to content

A Warning problem


bcode

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.