View Full Version : How to link from a database output?

05-06-2006, 08:10 PM
Hi all,

I have a view page, which lists all of the groups in a category, chosen in choose.php, via a dropdown.

What i wish to do is to make each group link to another page which will extract info aboput their albums and band info etc.

I cannot get this to work to save my life.

Please could somebody tell me how i can get this working?

Here is the code which views all of the groups under each category, ( categorys a-z are stored as category numbers 1-26 in db).

<?php require('Connections/xxxxxdb.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_xxxxxdb, $xxxxxdb);
$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, $xxxxxdb) 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;
<title>xxxxxx- Search Results</title>

<div align="center" class="style1 style10">

<?php echo $totalRows_Recordset1 ?> Category Result Found

<table width="383" border="0" align="center" cellpadding="8" cellspacing="5">
<td><div align="center" class="style5">Artist / Group </div></td>
<td><div align="center" class="style5">Album Title </div></td>

<?php do { ?>
<td class="style6"><div align="center"><?php echo $row_Recordset1['artist_name']; ?>
<td class="style6"><div align="center"><?php echo $row_Recordset1['album_title']; ?></div></td>

<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>

Thanks for any help,