Help in getting single value from an array


how I can create a query that searches for matching tags, I don’t want to have to query every article everytime someone clicks a tag. can anyone help? my initial thoughts were to create a row in the table where the articles are stored, named tags, and list the tags seperated by commas,

am using the PHP implode function
$tagsArray = implode(", ", $gameTags);
to insert tags into my gaming table
like you see in the image below what I want is to get back just one tag from the game_tag table like MMORPG tag or strategy tag to be able to show just let’s say strategy game in the strategy games page.
right now am using this code to get tags from the table

function getStrategyGames($conn){
$getGame = “SELECT * FROM browserGames”;
if ($stmt = $conn->prepare($getGame)) {
if ($stmt->execute()) {
if ($stmt->rowCount() > 0) {
$result = $stmt->fetch();
$gameTag = explode(’,’, $result[‘game_tag’]);
foreach($gameTag AS $single):
echo $single . “
the code above echo out all the tags i want way to echo out just the first element in the array or the second and so on.

thanks for help


Maybe use a query like
SELECT * FROM `browserGames` WHERE INSTR(`game_tag`, '{GAMETAGHERE}') > 0
SELECT * FROM `browserGames` WHERE `game_tag` LIKE '%GAMETAGHERE%'
GAMETAGHERE should be replaced by the tag that is searched for.


Does there a better way to make tables for tags and thanks the code above worked fine for me I never thought of using regular expressions lol


And one last thing for this topic let’s say that I have 40 games in my browse games table with the same tags it will show all the 40 game in that page and that’s too many request and not SEO friendly what I want is to get only 16 games peer page dynamicly create pages to show the rest of the games in it how can I do that my primary idea is to set a limit when I select from the database to 16 in the main page but how can I get the rest of the games when the user clicks on next page I lost myself in there so please can you help me with this to


Get inspired from


Sounds interesting thanks for the suggestion