本文介绍了从db表中选择行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在另一个线程中提到的项目中,我正试图获得一些

动态数据。在此唱片目录中,您可以点击

专辑名称,并在左侧显示专辑及其曲目的标题

。我已经开始了,如下:


***

< h3><?php echo $ row_rsindiv [' '相册'']; ?>< / h3>

< ol>

<?php do {?>

< li>< ;?php echo $ row_rsindiv [''Song'']; ?> (<?php echo $ row_rsindiv

[''时间''];?>)< / li>

<?php} while($ row_rsindiv = mysql_fetch_assoc($ rsindiv)); ?>

< / ol>


***


数据库样本:


***


电子冥想3冷烟10:48

电子冥想4灰烬3: 58

电子冥想5复活3:21

Alpha Centauri 6第三系统中的日出4:20

Alpha Centauri 7飞行和碰撞Comas Sola 13:23

Alpha Centauri 8 Alpha Centauri 22:04

Zeit 9液体暴君的诞生19:52

Zeit 10 Nebulous Dawn 17:47


***


我想告诉PHP编写专辑名称并列出
$中的曲目b $ b< li>< / li>基于主要

表中点击的任何专辑标题。


主表如下:


***


<?php do {?>

<?php

$ class =($ class ==''奇怪'')? ''偶''''''奇怪'';

?>

< 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)); ?>


***


我想可能要改变第一个< td>< / td> to:


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

<?php echo $ row_rstdream [''Album'']; ?>< / td>


但是,就我的知识有限而言,这是我所能得到的。

是否有人对如何仅显示第二个

数据库中与所点击的专辑名称相对应的行有任何想法?对不起

这个例子太长了,我希望这很有道理。


TIA

Ian

-

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/

推荐答案




这篇关于从db表中选择行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 02:17