håber jeg fik ret i dette.
prøv det med Hent alle
$rows = $query->fetchAll(PDO::FETCH_ASSOC);
i dit tilfælde
$sql='select uid,name from users where username=? and password=?';
$query=$con->prepare($sql);
$result=$query->execute(array($username,$password));
// check if a single row is returned
// i guess to avoid the warnings you can just set the array befor like
// $row = array();
// or put @ befor the VARS in the TRUE statement
$rows = $query->fetchAll(PDO::FETCH_ASSOC));
/**
if you have more than one result you can look at them like this
foreach ($rows as $row)
{
echo $row['uid'];
}
**/
if((count($rows)===1)
{
echo $_SESSION['id'][email protected]$rows['uid'];
echo $_SESSION['name'][email protected]$rows['name'];
// header('Location: lading_page.php');
}
else echo "Invalid username/password";