Firstly, I want to tell you that I use blob. therefore, I upload some photos, and I would like to create a search bar so that I can name it tag
from my database. My business right now is the following:
I can not find 2 words or more.
My database has a field called tag
and kategori
.
In tag
I put data likezat ; proses ; obat ;
Separated ;
(with a comma).
So here is my code for one search:
<html>
<body>
<?php
$conn = mysql_connect("localhost", "denis", "denis");
mysql_select_db("company");
echo($_POST["tag"]);
?>
<form method="POST" >
<font color='black'>Cari gambar:</font>
<input type="text" name="tag" value=" ">
<input type="submit" name="search" value="Cari"/>
</form>
<?php
if(isset ($_POST["tag"]))
{
$sql2="select imageId from output_images where bukuId=". $_GET["id"]." and tag like '%".$_POST["tag"]."%' Order by imageId asc";
}
else
{
$sql2="select imageId from output_images where bukuId=". $_GET["id"]." Order by imageId asc limit 1";
}`enter code here`
$res2=mysql_query($sql2,$conn);
while($row2=mysql_fetch_array($res2))
{
echo("<img src='http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/profile.php?image_id=". $row2["imageId"]. "' width='15%' height='30%'/>");
}
mysql_close();
mysql_close($conn);
?>
</body>
</html>
How can I do this for 2 words or more?
I heard about the explosion, but I donβt understand how to use it.
this is my database using a tag to search for my image
source
share