NightFlyer
05-19-2008, 05:59 PM
Hey. I want the image to link to whatever ID the question_id is. EXAMPLE:
newthread.php?question_id=(WHATEVERID)
Can you please help?
newthread.php?question_id=(WHATEVERID)
Can you please help?
|
||||
Link New threadNightFlyer 05-19-2008, 05:59 PM Hey. I want the image to link to whatever ID the question_id is. EXAMPLE: newthread.php?question_id=(WHATEVERID) Can you please help? Inigoesdr 05-19-2008, 06:34 PM What? Rephrase your question and provide more information. NightFlyer 05-19-2008, 07: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. EGZAMPLE@@@! 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. derzok 05-19-2008, 07: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=?"); $sth->execute(array($artistid)); $data = $sth->fetchAll(); $string = '<p class="content-head">All songs by artist <b>'. $data[0]['value'].'</b></p>'; $string .= '<table border="0" width="100%"><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/>'; $i++; } $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... NightFlyer 05-19-2008, 07: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. Inigoesdr 05-19-2008, 07: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. NightFlyer 05-19-2008, 08: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. Inigoesdr 05-19-2008, 08:30 PM Doesn't work :( Again, the lack of information is only preventing you from finding a solution. Post the code you tried. |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum