I have designed a simple code to fetch data using php but i am getting an error... Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, bool given in C:\xampp\htdocs\test.php on line 33 I have connected it with database without where clause condition it works but i need to run the code with condition so that i can fetch particular row.
<html lang="en">
<head>
<title>user registration</title>
</head>
<body>
<h1>Enter details</details></h1>
<form action="" method="GET">
firstname:<input type="text" name="firstname"/><br/>
lastname:<input type="text" name="lastname"/><br/>
<input type="submit" name="submit"/>
</form>
</body>
</html>
<?php
//connect database
$con=mysqli_connect("localhost:3307","root","","newdatabase") or die(mysqli_error());
//select all values from client table
$data="SELECT * FROM client where username='dsa'";
$val=mysqli_query($con,$data);
while($r=mysqli_fetch_row($val))
{
echo $r[0]." ".$r[1];
}
?>