The piece of code I have runs through the array and makes a clickable link of each element
foreach($query as $news_item)
{
?>
<li>
<a href= <?php echo base_url("pages/view/"); echo $news_item['game_id']; ?> >test</a>
</li>
<?php
}
I’m attempting to use the baseurl() to return to site url, then direct to the pages/view/ and then a variable of the game_id of the element in the array.
The example above gives me the follow url for the link;
http://helios.hud.ac.uk/u0862025/CodeIgniter/index.php/pages/view1
even though, there is clearly a / after view, its completely ignoring it and I’ve zero idea as to why as I’m still new to php.
Any help would be lovely!
Sounds like it’s stripping it out as part of the base_url function. Try this instead
<a href="<?php echo base_url("pages/view/{$news_item['game_id']}"); ?>">test</a>