Selecting rows from db table
From: Ian Rastall (idrastall_at_gmail.com)
Date: 01/31/05
- Next message: lkrubner_at_geocities.com: "ctype_alpha doesn't exist in PHP version 4.3????"
- Previous message: Steve: "Re: newbee stupid question regarding $initstartdate = date("d-m-Y");"
- Next in thread: Ian Rastall: "Re: Selecting rows from db table"
- Reply: Ian Rastall: "Re: Selecting rows from db table"
- Reply: Geoff Berrow: "Re: Selecting rows from db table"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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/
- Next message: lkrubner_at_geocities.com: "ctype_alpha doesn't exist in PHP version 4.3????"
- Previous message: Steve: "Re: newbee stupid question regarding $initstartdate = date("d-m-Y");"
- Next in thread: Ian Rastall: "Re: Selecting rows from db table"
- Reply: Ian Rastall: "Re: Selecting rows from db table"
- Reply: Geoff Berrow: "Re: Selecting rows from db table"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|