I don't really know PHP to begin with. I'm just trying to make a plugin work?
This part of the plugin should display news articles on a games profile page related to the game. It's being handled using the news systems own tags system. Give tags to an article.. give a tag to the game.. the game finds it and displays the item(s).
The problem being is that a game with no tags attached to it displays all of the news articles on the site instead of display that no news articles are found for this game.
Querying a not existing game with display that there are no news related to this game.
While the game that has tags attached to it displays the articles with that tag.
if($result_news = mysqli_query($link, "SELECT NewsTagsSELECTED FROM e107_games where id=".$gameID)){
if(mysqli_num_rows($result_news) > 0){
$row_news_array = mysqli_fetch_array($result_news);
$row_news_array = $row_news_array[0];
$row_news_array = explode(",", $row_news_array);
foreach ($row_news_array as $row_news_val) {
if($news_id_array = mysqli_query($link, "SELECT news_id FROM e107_news where news_meta_keywords like '%".$row_news_val."%'")){
if(mysqli_num_rows($news_id_array) > 0){
while($news_id_val = mysqli_fetch_array($news_id_array)) {
$news_id_val_array[] = $news_id_val[0];
}
}
}
}
$news_id_val_array = array_unique($news_id_val_array);
}
$news_tag_id_array = $news_id_val_array;
$sizeNewsTag = sizeof($news_tag_id_array);
if($sizeNewsTag == "") {
?>No news found for this game.<?php
}