Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
mysqli_query() expects parameter 1 to be mysqli, object given in C:\xampp\htdocs\Hospital management sysytem\logincode.php on line 10

What I have tried:

0){

 while($row = mysqli_fetch_assoc($result)){
    session_start();
	$_SESSION['username'] = $row['username'];
	
	$_SESSION['password'] = $row['password'];
	
	header("SUCCESS LOGIN");
 }
}else{
 echo "danger";
}


?>
Posted
Updated 28-Oct-22 19:23pm
v2
Comments
Richard Deeming 31-Oct-22 6:49am    
Based on that code snippet, you're storing your users' passwords in plain text. Don't do that!
Secure Password Authentication Explained Simply[^]

PHP even provides built-in functions to help you do the right thing:
PHP: password_hash[^]
PHP: password_verify[^]

1 solution

We can't tell: we have no access to your connection string, your code, or to your database. At a guess, $result is not what you think it is!

So try looking at this: PHP: mysqli_result::fetch_assoc - Manual[^] and compare the whole code with what you have written but not shown us.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900