View Full Version : Link New thread

05-19-2008, 06:59 PM
Hey. I want the image to link to whatever ID the question_id is. EXAMPLE:

Can you please help?

05-19-2008, 07:34 PM
What? Rephrase your question and provide more information.

05-19-2008, 08:10 PM
<a href="/forum/viewthreads.php?question_id="><img src="images/newthread.jpg" alt="newthread" width="100" height="35" border="0" /></a></a></td>

I want that to link to whatever ID it is.


This board ID is 9, So the image link should be: newthread.php?question_id=9

But all boards are not ID 9. I want it to be whatever ID it is.

The same thing as:
echo '<a href="/forum/viewthreads.php?question_id=' . $row['id'] . '">'.$row['name'].'</a>'; But this is an image link.

05-19-2008, 08:24 PM
Maybe this will help - I did the same thing just the other day while making a Guitar Tabs website. I wanted to list all of the songs that an artist did, so I wrote the following code:

function get_songs_by_artist($artistid) {
$dbh = $this->dbc();
$sth = $dbh->prepare("SELECT song.id,song.title,artist.value FROM song INNER JOIN artist ON song.artist=artist.id WHERE song.artist=?");
$data = $sth->fetchAll();
$string = '<p class="content-head">All songs by artist <b>'. $data[0]['value'].'</b></p>';
$string .= '<table border="0" width="100&#37;"><tr><td>';
$i = 0;
foreach($data as $row) {
if($i%15==0 && $i != 0) {
$string .= '</td><td>';
$string .= '<a href="index.php?action=showtab&tabid='.$row['id'].'" target="_blank">'.$row['title'].'</a><br/>';
$string .= '</td></tr></table>';
return $string;

Pretty much: you need to query your database and get the tabid (or threadid in your case) so that you can display it with each row. I hope my example helps...

05-19-2008, 08:45 PM
Yeah that's what I have on another page but I'm talking about a Image. You click the image and it does the same thing, just with an image.

05-19-2008, 08:46 PM
The same thing as:
echo '<a href="/forum/viewthreads.php?question_id=' . $row['id'] . '">'.$row['name'].'</a>'; But this is an image link.
Just replace the $row['name'] with your image code.

05-19-2008, 09:11 PM
Doesn't work :(

Hover your mouse over the new reply and you'll see something like: newreply.php?do=newreply&p=690574 See, That's an image but I cannot get mine to do that.

05-19-2008, 09:30 PM
Doesn't work :(
Again, the lack of information is only preventing you from finding a solution. Post the code you tried.