Selecting rows from db table

From: Ian Rastall (idrastall_at_gmail.com)
Date: 01/31/05


Date: 31 Jan 2005 05:38:00 GMT

In a project mentioned in another thread, I'm trying to get some
dynamic data to work. In this discography, you can click on an
album name, and the title of the album and its tracks will appear
on the left. I have the beginnings worked out, like so:

***

<h3><?php echo $row_rsindiv['Album']; ?></h3>
<ol>
  <?php do { ?>
  <li><?php echo $row_rsindiv['Song']; ?> (<?php echo $row_rsindiv
['Time']; ?>)</li>
  <?php } while ($row_rsindiv = mysql_fetch_assoc($rsindiv)); ?>
</ol>

***

A sample of the database:

***

Electronic Meditation 3 Cold Smoke 10:48
Electronic Meditation 4 Ashes to Ashes 3:58
Electronic Meditation 5 Resurrection 3:21
Alpha Centauri 6 Sunrise in the Third System 4:20
Alpha Centauri 7 Fly and Collision of Comas Sola 13:23
Alpha Centauri 8 Alpha Centauri 22:04
Zeit 9 Birth of Liquid Plejades 19:52
Zeit 10 Nebulous Dawn 17:47

***

I want to tell PHP to write the album name and list the tracks in
an <li></li> based on whatever album title is clicked in the main
table.

The main table looks like:

***

<?php do { ?>
  <?php
$class = ($class == 'odd') ? 'even' : 'odd';
?>
  <tr class="<?php echo $class ?>">
    <td><?php echo $row_rstdream['Album']; ?></td>
    <td><?php echo $row_rstdream['Year']; ?></td>
    <td><?php echo $row_rstdream['Era']; ?></td>
    <td><?php echo $row_rstdream['Type']; ?></td>
  </tr>
  <?php } while ($row_rstdream = mysql_fetch_assoc($rstdream)); ?>

***

I thought maybe of changing the first <td></td> to:

<td><a href="#" onclick="<?php $album = $row_rstdream['Album'] ?>">
<?php echo $row_rstdream['Album']; ?></td>

But that's as far as I can get with my limited knowledge. Does
anyone have any ideas on how to display only the rows in the second
database that correspond to the name of the album clicked on? Sorry
the examples are so long, and I hope this makes sense.

TIA
Ian

-- 
http://www.bookstacks.org/


Relevant Pages

  • prons with password scripts (newbie)
    ... using PHP so ... The site structure is something like this (under each album directory ... i have decided not to use the *logout* script.. ...
    (comp.lang.php)
  • Re: prons with password scripts (newbie)
    ... Without the logout button, you are leaving the session open. ... therefore the album recognition was probably built in anyway, ... > using PHP so ...
    (comp.lang.php)
  • Trouble extracting info from database
    ... Ah, I hope it's okay to keep posting questions, and sorry for the ... I've got a database set ... I've built a dynamic table that list Album, ...
    (comp.lang.php)
  • Re: fopen read and write problem
    ... VALUES;", $album, $track); ... could: php -q.php>inserts.sql ... >text the new text made ready for inserting into a database. ... >and I want to manipulate it them to look in the database.txt like this: ...
    (comp.lang.php)
  • How do I display this kind of 2-dim array value correctly?
    ... [PHP] ... Album "Phil" has been created ... Here is the class method I have so far that fails miserably: ...
    (comp.lang.php)