how do I list diferent fields from same query
Posted: Fri Jul 12, 2002 9:46 am
hope the title is clear, english is not my first language.
I have a database with all my CDs so what I want to do is list the CD titles, and songs of each in one table and in another table make a link to the coresponding songbook
the following works fine
<?php while($categorydb->next_record()): ?>
<li><a href="<?echo $categorydb->Record["id"];?>/<? echo $categorydb->Record["id"] ?>.htm">
<B><? echo $categorydb->Record["categoria"] ?></B>
<?php endwhile ?>
but then it gives an error on the second part
<?php while($categorydb->next_record()): ?>
<b><? echo $categorydb->Record["categoria"] ?></B>
<?
$currentcategory = $categorydb->Record["id"];
$seriedb = new Sample;
$seriequery = "select * from cd_titulos where catid = $currentcategory order by sid";
$seriedb->query($seriequery);
?>
<ul>
<?php while($seriedb->next_record()): ?>
<li>
<a href="<?echo $seriedb->Record["catid"];?>/<? echo $seriedb->Record["sid"] ?>.zip"><? echo $seriedb->Record["alt_text"];
?></a></li><br>
<?php endwhile ?>
</ul></font></p>
unless I do not end while after the first part, but then it also loops through all the htm code which is inbetween which I do not want.
any suggestion what I can do?
I have a database with all my CDs so what I want to do is list the CD titles, and songs of each in one table and in another table make a link to the coresponding songbook
the following works fine
<?php while($categorydb->next_record()): ?>
<li><a href="<?echo $categorydb->Record["id"];?>/<? echo $categorydb->Record["id"] ?>.htm">
<B><? echo $categorydb->Record["categoria"] ?></B>
<?php endwhile ?>
but then it gives an error on the second part
<?php while($categorydb->next_record()): ?>
<b><? echo $categorydb->Record["categoria"] ?></B>
<?
$currentcategory = $categorydb->Record["id"];
$seriedb = new Sample;
$seriequery = "select * from cd_titulos where catid = $currentcategory order by sid";
$seriedb->query($seriequery);
?>
<ul>
<?php while($seriedb->next_record()): ?>
<li>
<a href="<?echo $seriedb->Record["catid"];?>/<? echo $seriedb->Record["sid"] ?>.zip"><? echo $seriedb->Record["alt_text"];
?></a></li><br>
<?php endwhile ?>
</ul></font></p>
unless I do not end while after the first part, but then it also loops through all the htm code which is inbetween which I do not want.
any suggestion what I can do?