1
I have the following PHP code:
<?php
include("config.php");
if(!isset($_SESSION['user'])){
echo "you are not logged in,please click here to <a href='memberarea.html'>Login</a>";
} else{
$query = $_GET['query'];
$min_length = 3;
if(strlen($query) >= $min_length){
$query = htmlspecialchars($query);
$query = mysqli_real_escape_string($conn,$query);
$row_results = mysqli_query($conn,"SELECT * FROM books WHERE `Title` LIKE '%".$query."%' OR `category` LIKE '%".$query."%'OR `category` LIKE '%".$query."%'") or die(mysqli_error($conn));
if(mysqli_num_rows($row_results) > 0){
while($results = mysqli_fetch_array($row_results)){
echo "<span>".$results['Title']."</span>"
"</h3>".$results['category']."</p>";
}
}
else{
echo "No results";
}
}
else{
echo "Minimum length is ".$min_length;
}
}
?>
And in the echo
I want to customize using HTML and CSS. my question and how to enter HTML code in PHP?
You already do it there:
echo "<span>".$results['Title']."</span>"
(incidentally, there is one missing.
at the end of this line to concatenate with the next string). And here:"</h3>".$results['category']."</p>";
you are closing an elementh3
and ap
that don’t make much sense.– Woss
is not working we can talk in chat sff?
– Diana Madeira