Jump to content

[SOLVED] hyperlinking mysql results


jandrews

Recommended Posts

Hello all,

 

I am quite new to php and I can't seem to figure this one out although i have a feeling the answer is blindingly obvious.

 

Once a query has been made to a database and the results displayed in a table, how would I hyperlink each result to display a different url variable when clicked on?

 

I am sure that the $_Get comes into it somewhere but I'm not sure how to implement this code properly.

 

Any help would be greatly appreciated

 

James

Link to comment
https://forums.phpfreaks.com/topic/150522-solved-hyperlinking-mysql-results/
Share on other sites

Brilliant! Thank You.

 

But I don't want the hyperlinks to take the user to a different page, I just want the links to appear as variables in the url so that it will trigger other queries with url variables set.

 

Do you know how to do this?

 

Not sure what you mean by this, something similar to?

 

LINK

 

Then on the processing page to get that variable you would do something like:

 

$var1 = $_GET['var1'];

OK, I'll try to make as much sense as i can...

 

I have a query which returns the names of various music bands in alphabetical order and it works.

 

With you're help, I have managed to create a link for each result:

<a href=<?php echo $row_artists['playlist_music']; ?>"><?php echo $row_artists['playlist_music']; ?></a>

 

This is great because before I couldn't figure out how to do this.

 

Now this gives me the same results hyperlinked with no problem.

 

What I need to know now is how I use these same links but stay on the same page and just have the results link to a url variable of the same name when clicked on.

 

For example, one of the results is Bryan Adams, so when I click on Bryan Adams, I want to see ?artist=Bryan Adams in my url

You are a legend. Thanks for you're help

 

Just as you said:

   <tr>
                      <td>
				  <a href="bands.php?=<?php echo $row_artists['playlist_music']; ?>"><?php echo $row_artists['playlist_music']; ?></a></td>
                    </tr>
                    <?php } while ($row_artists = mysql_fetch_assoc($artists)); ?>
                </table></td>
            </tr>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.