Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 110690

Modify Master/Detail pages

$
0
0
<?php require_once('Connections/pdoConnect.php');?>
<?php
// Issue the query
$pdo_recordset1
= $conn->query("SELECT id, title, author, subject FROM audio");
$pdo_recordset1
->setFetchMode(PDO::FETCH_ASSOC);
?>

<!doctype html>
<html>
<head>
<metacharset="utf-8">
<title>Audio List</title>
</head>

<body>
<?php
// Now iterate over every row and display it
$n
=0;
while($r = $pdo_recordset1->fetch(PDO::FETCH_ASSOC))
{
?>
<a href="PDO_detail.php?item=
<?php echo $r['id']?>">
<?php echo ($r['subject'])?><?php echo ($r['title'])?><?php echo ($r['author'])?></a><br/>
<?php
++$n;
}
if(0== $n)
{
echo
"Sorry there are no items to display";
}
?>

</body>
</html>

This is the code produced by DW Master/Detail pages for the Master page using the PDO extension. This produces a list of all entries in the database. However I want to separate out the "subject" data as a heading above each title within that subject group. Eg:

SUBJECT 1

title 1

title 2

title 3

 

SUBJECT 2

title 1

title 2

etc

 

I think this will require an array of the subjects and a nested loop for the titles, but not sure how to modify the code to achieve this - any help would be very welcome.


Viewing all articles
Browse latest Browse all 110690

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>