Stevis2002 Posted May 7, 2006 Share Posted May 7, 2006 Hi all,I have a page (choice.php), with a dropdown menu, populated with categories, (A-Z).When one is chosen, it populates the page, (view.php), with the contents of the category which has artists in.The category is chosen when the selection is made from teh dropdown, which passes the appropiate id, (http://www.srtfdgtr.com/view.php?id=1, (A-1, Z-26)).What i wish to know is how i can get the outputted artists names to make a link which will then go to another page which will display the appropiate info for each artist from the database fields, artist_name, album_title, and album info?Here's the code for view.php[code]<?php require('Connections/xxxdb.php'); ?><?php$maxRows_Recordset1 = 10;$pageNum_Recordset1 = 0;if (isset($_GET['pageNum_Recordset1'])) { $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];}$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;$colname_Recordset1 = "-1";if (isset($_GET['category'])) { $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['category'] : addslashes($_GET['category']);}mysql_select_db($database_xxxdb, $xxxdb);$query_Recordset1 = sprintf("SELECT id, artist_name, album_title, category FROM upload2 WHERE category = '%s' ORDER BY artist_name DESC", $colname_Recordset1);$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);$Recordset1 = mysql_query($query_limit_Recordset1, $xxxdb) or die(mysql_error());$row_Recordset1 = mysql_fetch_assoc($Recordset1);if (isset($_GET['totalRows_Recordset1'])) { $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];} else { $all_Recordset1 = mysql_query($query_Recordset1); $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);}$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;?><link href="/standard.css" rel="stylesheet" type="text/css"><style type="text/css"><!--.style10 { font-size: 14; color: #999933;}--></style><title>xxx - Search Results</title><p> </p><div align="center" class="style1 style10"> <p><?php echo $totalRows_Recordset1 ?> Category Result Found<br> </p></div><table width="383" border="0" align="center" cellpadding="8" cellspacing="5"> <tr> <td><div align="center" class="style5">Artist / Group </div></td> <td><div align="center" class="style5">Album Title </div></td> </tr> <?php do { ?> <tr> <td class="style6"><div align="center"><?php echo $row_Recordset1['artist_name']; ?></div></td> <td class="style6"><div align="center"><?php echo $row_Recordset1['album_title']; ?></div></td> </tr> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?></table><?phpmysql_free_result($Recordset1);?>[/code]Thanks all Quote Link to comment Share on other sites More sharing options...
emehrkay Posted May 7, 2006 Share Posted May 7, 2006 this shouldnt be too difficult to do. you already have the page outputting data, you just need to edit a litlethis section here where you echo a td with the artist's name you can easily make it a link<td class="style6"><div align="center"><?php echo $row_Recordset1['artist_name']; ?></div></td><td class="style6"><div align="center"><?php echo <a href\"=page.php?id=".$row_Recordset1['id']."\">".$row_Recordset1['artist_name']."</a>; ?></div></td>then on page.php do$id = $_GET['id];and run a query based on that $id$query = "SELECT * FROM table WHERE id = ". $id .""; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.