Reputation: 63
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
<?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. My output is "No movies under that tag"; Im sorry if this is a copy i really looked and could not find an answer
Upvotes: 0
Views: 58
Reputation: 573
try this :
$ASDsql = "SELECT * FROM movie WHERE tags LIKE '%$fulltag%' OR tags =
'%$fulltag%'";
or may be the table is not having any value
Upvotes: 1