I am trying to display the query results within a list so that they change dynamically depending on the query results, how ever I am having trouble trying to display the results on between the tags
<?php
include 'dbh.php';
$BOOKNAME=$_GET['bookname'];
$sql="SELECT * FROM book WHERE
BOOKNAME LIKE '$BOOKNAME%' ";
$result=$conn->query($sql);
while($row=mysqli_fetch_array($result)){}
?>
<html>
<link rel="stylesheet" href="css/reset.css" type="text/css">
<link rel="stylesheet" href="css/index.css" type="text/css">
<div class="result1" >
<ul>
<li><a href="#home"> <p><?php echo $row['BOOKNAME'] ;?><p></a></li>
<li><a href="#">Book2</a></li>
<li><a href="#contact">Book3</a></li>
<li><a href="#about">Book4</a></li>
<li><a href="#about">Book5</a></li>
</ul>
</div>
</html>
Your code structure is incorrect. In order to display DB fetched values in your html use the following code:
<?php
include 'dbh.php';
$BOOKNAME=$_GET['bookname'];
$sql="SELECT * FROM book WHERE
BOOKNAME LIKE '$BOOKNAME%' ";
$result=$conn->query($sql);
?>
<html>
<head>
<link rel="stylesheet" href="css/reset.css" type="text/css">
<link rel="stylesheet" href="css/index.css" type="text/css">
</head>
<body>
<div class="result1" >
<ul>
<?php
while($row=mysqli_fetch_array($result))
{
echo '<li><a href="#something"><p>'.$row['BOOKNAME'].'<p></a></li>';
}
?>
</ul>
</div>
</body>
</html>
try this instead -
<?php
include 'dbh.php';
$BOOKNAME=$_GET['bookname'];
$sql="SELECT * FROM book WHERE
BOOKNAME LIKE '$BOOKNAME%' ";
$result=$conn->query($sql);
?>
<html>
<link rel="stylesheet" href="css/reset.css" type="text/css">
<link rel="stylesheet" href="css/index.css" type="text/css">
<div class="result1" >
<ul>
<?php while($row=mysqli_fetch_array($result)){ ?>
<li><a href="#home"> <p><?php echo $row['BOOKNAME']; ?><p></a></li>
<?php } ?>
</ul>
</div>
</html>