I have this piece of code that pulls an some info from database to create image with title, hyperlinked to an article. The problem is that the link to article changed, and I'm having trouble pulling required piece from database and inserting it here.
I have table called "issues" where one of the columns "slug" is the required piece for the new url to work. I've included 2 "INSERT HERE" in the code so you can see where "slug" needs to go. The information is ordered by date and the most recent item is pulled. I tried the same method for "slug" as used for "onlinecomic", but I can't get it to work.PHP Code:<?php
$onlinecomics = mysql_query("SELECT `articles`.`slug`, `image_id`, `name` FROM `articles` JOIN `tagstoarticles` ON `articles`.`id` = `tagstoarticles`.`article_id` WHERE `articles`.`status` = 'published' AND `tagstoarticles`.`tag_id` = '350' ORDER BY `date` DESC LIMIT 1;");
$onlinecomic = mysql_fetch_assoc($onlinecomics);
?>
<table cellpadding="0" cellspacing="0" width="95%" style="padding-bottom:10px;" class="online">
<tr>
<td colspan="2">
<h2>Online Cartoon</h2>
</td>
</tr>
<tr>
<td style="padding-bottom:4px" colspan="2"><a href="/article/INSERT HERE/<?php echo urlencode($issue['slug']); ?>/<?php echo urlencode($onlinecomic['slug']); ?>"><img src="/files/cache/<?php echo intval($onlinecomic['image_id']); ?>_smartsize_240_160.jpg" style="border:1px solid #999999" width="240" height="160"></a></td>
</tr>
<tr>
<td style="padding-bottom:5px" align="center" colspan="2">
<span class="title"><a href="/article/INSERT HERE/<?php echo urlencode($onlinecomic['slug']); ?>"><?php echo htmlentities($onlinecomic['name']); ?></a></span>
</td>
</tr>
</tr>
</table>
I would really appreciate help any help.



Reply With Quote
Bookmarks