简体   繁体   English

PHP将不会显示数据库中请求的数据(SQL)

[英]Php won't show requested data from database (sql)

Im trying to display all the movies with specific hashtag. 我试图显示所有带有特定标签的电影。

The results are not showing but there are no errors. 结果没有显示,但是没有错误。

However i should get movie poster image and title as result. 但是我应该得到电影海报的图像和标题。 :/ :/

In my database, this is 'tags' row of one movie 在我的数据库中,这是一部电影的“标签”行

#watchonline #movies-with-subs #hdmovies

and tag.php 和tag.php

<?php
require "db.inc.php";

if (isset($_GET['tag'])) {
$tag = preg_replace('#[^a-z0-9_-]#i', '', $_GET["tag"]);
$fulltag = "#" . $tag;
echo $fulltag;
$ASDsql = "SELECT * FROM movie WHERE tags LIKE '$fulltag' OR tags = 
'$fulltag'";
$tagQuery = mysqli_query($db, $ASDsql);

$count = mysqli_num_rows($tagQuery);
if($count > 0) {
while ($hastags = mysqli_fetch_array($tagQuery)) {
$id = $hastags['id'];

$movie_title = $hastags['movie_title'];

$movie_url = $hastags['movie_url'];

$movie_image = $hastags['movie_image'];


$movie_identity = $hastags['movie_identity'];

echo "<div class='item'><a href='movie.php?movie=$id'><img 
src='$movie_image'><p>$movie_title</p></a></div>";
}
}else {
echo "No movies under that tag";
}
}
?>

I've checked db.inc.php file it's all good. 我检查了db.inc.php文件,一切都很好。 My output is "No movies under that tag"; 我的输出是“该标签下没有电影”; Im sorry if this is a copy i really looked and could not find an answer 很抱歉,如果这是我真正看过的副本,找不到答案

try this : 尝试这个 :

 $ASDsql = "SELECT * FROM movie WHERE tags LIKE '%$fulltag%' OR tags = 
'%$fulltag%'";

or may be the table is not having any value 或者表可能没有任何价值

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM