e107help.org Q&A
0 like 0 dislike

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




e107 version 2.2.1
closed with the note: Not e107 related but PHP. Please look into the developer manual to use the correct e107 methods: https://e107.org/developer-manual#database
in Plugins by (27 points) 2 6 10
closed by
if no response will be given please try https://gitter.im/e107inc/e107
Did you just replace mysql with mysqli? It will not work. You should use e107 functionality for working with database. What plugin is this? By code it looks like some really old one by aacgc (or similar nick)
Welcome to e107 Q&A, where you can ask questions and receive answers from other members of the e107 community.
981 questions
1,378 answers
2,504 users