这是我的搜索 php 代码,它工作正常,但我想返回游戏的链接。在这段代码中,当我点击搜索时,我能够看到游戏名称,但我想根据我正在搜索的内容查看我的游戏列表。我必须做些什么来显示游戏而不是只返回它的名称?谢谢
table `jogos`
--
CREATE TABLE IF NOT EXISTS `jogos` (
`idGames` int(11) NOT NULL AUTO_INCREMENT,
`strNome` varchar(100) DEFAULT NULL,
`strSeo` varchar(100) DEFAULT NULL,
`intCategoria` int(11) DEFAULT NULL,
`strImage` varchar(50) DEFAULT NULL,
PRIMARY KEY (`idGames`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
INSERT INTO `jogos` (`idGames`, `strNome`, `strSeo`, `intCategoria`, `strImage`) VALUES
(4, 'Quake', 'Quake', 1, 'Folder.jpg');
--
<?php
if (isset($_GET['query'])){
$query = $_GET['query'];
$min_length = 3;
if(strlen($query) >= $min_length){
$query = htmlspecialchars($query);
$query = mysql_real_escape_string($query);
$raw_results = mysql_query("SELECT * FROM jogos
WHERE (`strNome` LIKE '%".$query."%')") or die(mysql_error());
if(mysql_num_rows($raw_results) > 0){ // if one or more rows are returned do following
while($results = mysql_fetch_array($raw_results)){
echo "<p>".$results['strGame']."</p>";
}
}
else{ // if there is no matching rows do following
echo "No results";
}
}
else{ // if query length is less than minimum
echo "Minimum length is ".$min_length;
}
}
?>
</body>
</html>
<?php
mysql_free_result($GameData);
?>