I am working on my web project and i am trying to make a search bar using php and MySql data base.But every time I get above Warning message and I have tried almost every solution on Stack Overflow.
But any of that wont give me any improvement.In my database there is a table named 'project_2013' and it has 4 columns 'ID,NAME,PROJECT,TITLE'.This is the php code I have used.
<?php
if(isset($_POST['search'])){
$searchTerm = $_POST['search'];
'%$searchTerm%'";
$query = "SELECT * FORM project_2013 WHERE TITLE LIKE
'%".mysqli_real_escape_string($con, $searchTerm)."%'";
$result = mysqli_query($con,$query);
$count = mysqli_num_rows($result);
if ($count == 0){
echo 'SORRY Nothing in our Server...';
}
else{
while($row = mysqli_fetch_array($query)){
$title = $row['TITLE'];
$projectName = $row['PROJECT'];
$name = $row['NAME'];
echo '<br>';
echo '<div class = "row">';//row start
echo '<div id = "content" class = "col-lg-12 col-md-12 col-sm-12 col-xs-12">'; //div1
echo '<b>Title:</b> ' . $row['TITLE'] . '<br>';
echo '<b>Research Paper:</b> ' . '<a href = "documents/2013_2014/' . $row['PROJECT'] .'" target = "_blank">'. $row['TITLE'] . '</a>' . '<br>';
echo '<b>Conducted By:</b> ' . $row['NAME'] . '<br>';
echo '</div>';//end of div1
echo '</div>';//row end
echo '<hr>';
}
}
}?>
This is the form tag part.
<form action = "Home.php" method = "post">
<div class="input-group">
<input type="text" class="form-control" name = "search" placeholder="Search for Research...">
<span class="input-group-btn">
<button class="btn btn-default" type="submit" name="submit">
<span class="glyphicon glyphicon-search"></span></button>
</span>
</div><!-- /input-group -->