close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Master/Details page

Thread began 7/10/2017 6:05 am by Leon | Last modified 7/12/2017 9:08 am by Ray Borduin | 1412 views | 4 replies |

Leon

Master/Details page

I am trying to build a master/details page:

master:

<?php require_once('Connections/mitoWebsiteMSQLI.php'); ?>
<?php require_once('webassist/mysqli/rsobj.php'); ?>
<?php
//query lists all database records?>
<?php
$masterAllRecordset1 = new WA_MySQLi_RS("masterAllRecordset1",$mitoWebsiteMSQLI,10);
$masterAllRecordset1->setQuery("SELECT * FROM completedProjects");
$masterAllRecordset1->execute();
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>

<body>
<ul>
<?php
while(!$masterAllRecordset1->atEnd()) {
?>
<li><a href="details1.php?bymission_id=<?php echo($masterAllRecordset1->getColumnVal("mission_id")); ?>"><?php echo($masterAllRecordset1->getColumnVal("project_name")); ?></a></li>
<?php
$masterAllRecordset1->moveNext();
}
$masterAllRecordset1->moveFirst(); //return RS to first record
?>
</ul>
</body>
</html>

Details:

<?php require_once('Connections/mitoWebsiteMSQLI.php'); ?>
<?php require_once('webassist/mysqli/rsobj.php'); ?>
<?php
$details1Recordset1 = new WA_MySQLi_RS("details1Recordset1",$mitoWebsiteMSQLI,1);
$details1Recordset1->setQuery("SELECT * FROM completedProjects WHERE mission_id = ?");
$details1Recordset1->bindParam("i", "".(isset($_GET['bymission_id'])?$_GET['bymission_id']:"") ."", "-1"); //colname
$details1Recordset1->execute();
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>

<body
<?php echo($details1Recordset1->getColumnVal("project_name")); ?></body>
</html>

This is a simple Master/detail. I am having issues with the details page returning no value from the master page. It seems that the master page does go to the details page when the link is clicked, but no data is returned or printed to the page on the details page.
Please help me resolve this
Thank you.

Sign in to reply to this post

Jason Byrnes

the code for the body tag on the details page is off. edit:

php:
<body

<?php echo($details1Recordset1->getColumnVal("project_name")); ?></body>



to:

php:
<body>

<?php echo($details1Recordset1->getColumnVal("project_name")); ?></body>




Note the change of "<body" to "<body>".

Sign in to reply to this post

Leon

Thank you for the correction. I have made the changes and started again.

Master:

<?php require_once('Connections/mitoWebsiteMSQLI.php'); ?>
<?php require_once('webassist/mysqli/rsobj.php'); ?>
<?php
$master2Recordset1 = new WA_MySQLi_RS("master2Recordset1",$mitoWebsiteMSQLI,10);
$master2Recordset1->setQuery("SELECT * FROM completedProjects ORDER BY project_name ASC");
$master2Recordset1->execute();
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>

<body>
<ul>
<?php
while(!$master2Recordset1->atEnd()) {
?>
<li><a href="details2.php?mission_id=<?php echo($master2Recordset1->getColumnVal("mission_id")); ?>"><?php echo($master2Recordset1->getColumnVal("project_name")); ?></a></li>
<?php
$master2Recordset1->moveNext();
}
$master2Recordset1->moveFirst(); //return RS to first record
?>
</ul>
</body>
</html>

Details:

<?php require_once('Connections/mitoWebsiteMSQLI.php'); ?>
<?php require_once('webassist/mysqli/rsobj.php'); ?>
<?php
$details2Recordset1 = new WA_MySQLi_RS("details2Recordset1",$mitoWebsiteMSQLI,1);
$details2Recordset1->setQuery("SELECT * FROM completedProjects");
$details2Recordset1->execute();
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>

<body>
<ul>
<li><?php echo($details2Recordset1->getColumnVal("client_name")); ?></li>
<li><?php echo($details2Recordset1->getColumnVal("project_name")); ?></li>
</ul>
</body>
</html>

The details data is showing for the first record only. When I click on the link from the masters page it will take me to the details page and list the first project, no matter what link I click on the masters list.

Sign in to reply to this post

Jason Byrnes

On the details page, you have not set a filter for the record set (you did have the filter correct on the first one). the record set needs to filter the mission_id column using the mission_id URL variable being passed in the link.

Sign in to reply to this post

Leon

Jason,
Thank you very much. I have added the filter by URL in the details page to match URL param in the master page to "mission_id"(unique identifier) per your advice and it has worked.

master link:
<li><a href="details2.php?mission_id=<?php echo($master2Recordset1->getColumnVal("mission_id")); ?>"><?php echo($master2Recordset1->getColumnVal("project_name")); ?></a></li>

so the master page stays the same as previous step and the details page recordset reflects the filterby option in the Where statement. Correct?

<?php require_once('Connections/mitoWebsiteMSQLI.php'); ?>
<?php require_once('webassist/mysqli/rsobj.php'); ?>
<?php
$details2Recordset1 = new WA_MySQLi_RS("details2Recordset1",$mitoWebsiteMSQLI,1);
$details2Recordset1->setQuery("SELECT * FROM completedProjects WHERE mission_id = ? ORDER BY project_name ASC");
$details2Recordset1->bindParam("i", "".(isset($_GET['mission_id'])?$_GET['mission_id']:"") ."", "-1"); //colname
$details2Recordset1->execute();
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>

<body>
<ul>
<li><?php echo($details2Recordset1->getColumnVal("client_name")); ?></li>
<li><?php echo($details2Recordset1->getColumnVal("project_name")); ?></li>
</ul>
</body>
</html>

See image. Also can use(just for my reference)
https://helpx.adobe.com/dreamweaver/using/building-master-detail-pages.html

Thanks for you help again Jason

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...