hello Again!!!
& Happy new year to All๐
i m trying to make a search page.
the code is.....
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<?php
include("config.inc.php");
if(isset($_GET['search']))
{
$search = $_GET['search'];
}
$keywords = explode(" ", $search);
$query = "SELECT photo_id,photo_filename,photo_caption,photo_category,Gerne,First,Last,elm1,photo_category1,date_submited,enddate FROM gallery_photos " .
"WHERE First LIKE '%".$keywords['0']."%'";
for ($i=1; $i<count($keywords); $i++) {
$query = $query." OR First LIKE '%".$keywords[$i]."%'";
}
$result = mysql_query($query) or die(mysql_error());
?>
<center>
<form method="GET" action="search1.php">
<b>Search:</b> <input type="text" name="search" size="20" />
<input type="submit" value="Search!" />
</form>
<table width="50%" style="border:1px solid #000000;">
<?php
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td style='border-bottom: 1px solid #000000;'>";
echo "<b>".$row['photo_caption']."</b>";
echo "<p>".$row['First']."</p>";
echo "<p>".$row['Last']."</p>";
echo "<p>".$row['photo_filename']."</p>";
echo "<p>".$row['photo_category1']."</p>";
echo "<p>".$row['enddate']."</p>";
echo "<b>".$row['date_submited']."</b>";
echo "</td>";
echo "</tr>";
}
?>
</td>
</tr>
</table>
<a href="HTMLinput.htm">Add new record to our DataBank.</a>
</center>
</body>
</html>
when i first load this page i m geting all the results of my table gallery_photos
but when im using the search field i dont get any results or errors๐
Can any1 Help me pls????