In the below code i have a php code when i search for a particular variable ie iam looking for a variable which starts in b.All the variable which starts in b are displaying one by one in alertbox.But i want to display in one alert. Actual result:it displays one by one alert
<?php
$search = (isset($_POST['search']) ? $_POST['search'] : null);
mysql_connect("localhost", "root", "") OR die (mysql_error());
mysql_select_db ("slseatapp") or die(mysql_error());
$query = "SELECT * FROM `coursemaster` WHERE `course_code` LIKE '%$search%' or `course_name` like '%$search%'";
$result = mysql_query($query) or die (mysql_error());
if($result)
{
while($row=mysql_fetch_row($result))
{
echo"<script>alert('ID=$row[0],COURSE CODE=$row[1],COURSE NAME=$row[2]');</script>";
}
}
else
{
echo "No result";
}
?>
<form action="coursemaster_view" method="post">
<center> SEARCH:<input type="text" name="search" placeholder="SEARCH"><br></center>
<center> <input type="submit" class="btn-success btn"></center>
</form>