Sejoo
Sejoo

Reputation: 63

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

<?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

Answers (1)

shashikant kuswaha
shashikant kuswaha

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

Related Questions