I am trying to fetch some data from my sql table, I've already done it but now it wont work with the same code. Here it is:
$cat = "";
$res = "";
$date = "";
$sql2 = "SELECT category, result, date FROM results WHERE user='" . $_SESSION['login_user'] . "'";
$result2 = mysql_query($sql);
$count2 = mysql_num_rows($result2);
if($count2 == 1)
{
$row2 = mysql_fetch_assoc($result2);
$cat = $row2["category"];
$res = $row2["result"];
$date = $row2["date"];
}
I keep getting the following error:
Notice: Undefined index: category in C:\xampp\htdocs\Own\RiskCarePHP\profile.php on line 59
Notice: Undefined index: result in C:\xampp\htdocs\Own\RiskCarePHP\profile.php on line 60
Notice: Undefined index: date in C:\xampp\htdocs\Own\RiskCarePHP\profile.php on line 61
Whats wrong with it?