我正在尝试进行图片搜索。它会显示电影的图像,我也希望电影名称显示在图像下方。这是我得到远如何制作图片搜索引擎?
在我phpMy我有5行
ID INT(11)
标题为varchar(100)
说明文字
URL文本
keywords varchar(100)
这是我的搜索ba [R
<div>
<form action='/search.php' method='GET' style="margin-bottom:1px;">
<input id='searchbar' type='text' size='65' name='search' placeholder="search for movies & tv shows">
<input id='submit' type='submit' name='submit' value='Search' >
</form>
</div>
,这是结果页面
<html>
<head>
<title>FastMegaMedia</title>
<link rel="icon" href="img/putlockermedia_logo.png" type="image/icon">
<link rel="stylesheet" href="Style/index.css" media="screen">
</head>
<body>
<?php include_once("/php/header.php"); ?>
<table id=content width="100%" height="25" border="0" cellpadding="0" cellspacing="0">
<?php include_once("/php/ad1.php"); ?>
<td width="63%" valign="top">
<section class="content"> <!-- start of conntent -->
<?php
$x = 0;
$construct = '';
$button = $_GET ['submit'];
$search = $_GET ['search'];
if(!$button)
echo "you didn't submit a keyword";
else
{
if(strlen($search)<=1)
echo "Search term too short";
else{
echo "You searched for <b>$search</b> <hr size='1'></br>";
mysql_connect("localhost","root","");
mysql_select_db("search");
$search_exploded = explode (" ", $search);
foreach($search_exploded as $search_each)
{
$x++;
if($x==1)
$construct .="keywords LIKE '%$search_each%'";
else
$construct .="AND keywords LIKE '%$search_each%'";
}
$construct ="SELECT * FROM searchengine WHERE $construct";
$run = mysql_query($construct);
$foundnum = mysql_num_rows($run);
if ($foundnum==0)
echo "Sorry, there are no matching result for <b>$search</b>.</br></br><li>
Try more general words. for example: If you want to search 'how to create a website'
then use general keyword like 'create' 'website'</li><li> Try different words with similar
meaning</li><li> make sure you are spelling is correct</li>";
else
{
echo "$foundnum results found !<p>";
while($runrows = mysql_fetch_assoc($run))
{
$title = $runrows ['title'];
$desc = $runrows ['description'];
$url = $runrows ['url'];
echo "
<a href='$url'><b>$title</b></a><br>
$desc<br>
<a href='$url'></a><p>
";
}
}
}
}
?>
</section> <!-- end of conntent -->
</td>
<?php include_once("/php/ad2.php"); ?>
</table>
</body>
</html>
我有什么可以做,使之显示图像,而不是仅仅显示丝毫不差,我知道我失去了一些东西。我是新对此顺便说一句好吧
id你概述你的代码,其更好的可读性 – Rickert