Why not output the data from the database?


$res = mysqli_query($connection, "SELECT videos.* FROM video_category JOIN category ON category.id = video_category.category_id JOIN videos ON videos.id = video_category.video_id WHERE video_category.category_id = " .(int)$_GET['video_category.category_id']);

$videos = array();
while($row = mysqli_fetch_array($res)){
$videos[] = $row;
}
?>
<?php foreach($videos as $v): ?>
the <ul>
 the <li> 
 <div class="videos_image"> 
 <a href="shplayer/shablon.php?id=<?php echo $v['id']; ?>"><img class="videos__image" src="/media/images/<?php echo $v['img']?>" width="250" height="180" alt="<?php echo $v['title']?>"></a>
 <div id="videos_image">
 <img src="/media/views.png" id="views">
 <span class="videos_views"><?php echo $v['views'] ?></span>
</div>
 </div> 


 <?php 
 if (empty($videos)) die('our database, there are no pictures or request curve'); 
 ?> 

 <div class="videos_title"> 
 <span class="title_alt"><?php echo mb_substr($v['title'], 0, 26, 'utf-8') . '...';?> </span>
 </div> 
</li>
 </ul> 
 <?php endforeach?>


Not displayed data from the database, although the query is correct query in the database is returned.

11214d894d7841c8ac3a0bca52c034ca.pngad47f00b5fd44d4e83f4d195f1c100b9.pngccc2357239d6414dbb8a5c2a0b03c16a.png
June 26th 19 at 14:35
2 answers
June 26th 19 at 14:37
Solution
Get error
There is not any errors, just nothing is displayed, that contains $res mysqli_result Object ( [current_field] => 0 [field_count] => 7 [lengths] => [num_rows] => 0 [type] => 0 ) - humberto.Wuckert18 commented on June 26th 19 at 14:40
: okay and gets parameter what? - mina50 commented on June 26th 19 at 14:43
: The Id of the category to be displayed on the page all the info from this category - humberto.Wuckert18 commented on June 26th 19 at 14:46
: exactly what - mina50 commented on June 26th 19 at 14:49
: I mean - humberto.Wuckert18 commented on June 26th 19 at 14:52
: omfg
var_dump($_GET); - mina50 commented on June 26th 19 at 14:55
There is not any errors

if $res returns false, it means there is an error of mysql - mina50 commented on June 26th 19 at 14:58
What keeps var_dump($res) object(mysqli_result)#2 (5) { ["current_field"]=> int(0) ["field_count"]=> int(7) ["lengths"]=> NULL ["num_rows"]=> int(4) ["type"]=> int(0) }
get parameters: array(1) { ["id"]=> string(1) "1" } - humberto.Wuckert18 commented on June 26th 19 at 15:01
well, then the answer to the question of why nothing displays. compare what is in your name and that of his want to - mina50 commented on June 26th 19 at 15:04
$res = mysqli_query($connection, "SELECT videos.* FROM video_category INNER JOIN category ON category.id = video_category.category_id INNER JOIN videos ON videos.id = video_category.video_id WHERE video_category.category_id = " .((int)$_GET['id']));
- mina50 commented on June 26th 19 at 15:07
but the query only displays one record - humberto.Wuckert18 commented on June 26th 19 at 15:10
: not, all right, I have old phpmyadmin - humberto.Wuckert18 commented on June 26th 19 at 15:13
June 26th 19 at 14:39
The guy who deleted the thread with my answers, you did a good job of course.
I repeat:
SELECT v.* FROM videos LEFT JOIN video_category vc ON vc.video_id = v.id WHERE vc.category_id = %n%
Not true, $res is empty - humberto.Wuckert18 commented on June 26th 19 at 14:42
: Here's a screenshot of the database made - mina50 commented on June 26th 19 at 14:45

Find more questions by tags PHP