close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Detail page combining input from two tables

Thread began 6/28/2010 7:57 am by jeffmg279672 | Last modified 7/12/2010 4:47 pm by Jason Byrnes | 2263 views | 7 replies |

jeffmg279672

Detail page combining input from two tables

Hi. I've got a database set up with 2 tables - 1 contains details veterinary practices, the other contains reviews of those practices.
I've set up a search page which searches by location then outputs the results to a results page. This in turn links to a detail page in the usual way. What I want to do, though, is to have the detail page also show whatever reviews have been posted against the practice in the reviews table. I've set these up properly with foreign key, InnoDB etc etc. What I want to know is whether it's possible to do this using DataAssist and if you can point me in the direction either of a solution recipe, tutorial or anything else that will walk me through it. Thanks in advance.

Sign in to reply to this post

Jason ByrnesWebAssist

The data assist will not be able to create this detail page for you. it can create the display of the Practice details, but you will need to manually add the display of the reviews.

To show the reviews, you will need to create a new recordset on the detail page to lookup the reviews for the practice.

The Practice is passed into the detail page using a URL Parameter.

Take a look at the Redordset that data assist creates get the name of the URL prameter that is being passed in.

The recordset you create will be very similar, the only differences being that it is searching the reviews table and filtering the Foreign Key column on the passed URL parameter.

Once the recordset is created, you can add a table to detail page to show the reviews, using a repeat region.

Sign in to reply to this post

jeffmg279672

Thanks, sorry for not responding before but I've been away for a few days.
I looked at the recordset that DA created and it shows the variable WADAlocation which I assume is the URL parameter that you refer to?

The code for the recordset is:

<?php
$maxRows_WADApracticelist = 10;
$pageNum_WADApracticelist = 0;
if (isset($_GET['pageNum_WADApracticelist'])) {
$pageNum_WADApracticelist = $_GET['pageNum_WADApracticelist'];
}
$startRow_WADApracticelist = $pageNum_WADApracticelist * $maxRows_WADApracticelist;

$WADAlocation_WADApracticelist = "-1";
if (isset($_POST['location'])) {
$WADAlocation_WADApracticelist = (get_magic_quotes_gpc()) ? $_POST['location'] : addslashes($_POST['location']);
}
mysql_select_db($database_connGVG, $connGVG);
$query_WADApracticelist = "SELECT practice_id, practicename, address1, address2, address3, address4, postcode, location, practicewebsite, practicetype, starrating FROM practicelist ORDER BY practicename ASC";
setQueryBuilderSource($query_WADApracticelist,$WADbSearch1,false);
$query_limit_WADApracticelist = sprintf("%s LIMIT %d, %d", $query_WADApracticelist, $startRow_WADApracticelist, $maxRows_WADApracticelist);
$WADApracticelist = mysql_query($query_limit_WADApracticelist, $connGVG) or die(mysql_error());
$row_WADApracticelist = mysql_fetch_assoc($WADApracticelist);

if (isset($_GET['totalRows_WADApracticelist'])) {
$totalRows_WADApracticelist = $_GET['totalRows_WADApracticelist'];
} else {
$all_WADApracticelist = mysql_query($query_WADApracticelist);
$totalRows_WADApracticelist = mysql_num_rows($all_WADApracticelist);
}
$totalPages_WADApracticelist = ceil($totalRows_WADApracticelist/$maxRows_WADApracticelist)-1;
?>

I also have a related issue which I'm not clear about resolving:
I want to have a second form which is essentially an upload form which will allow people to post reviews for the different Practices to the Reviews table, but I want to have the list of practices as a drop-down list/menu at the top of the form so that the review is then associated with the correct practice.
Is this as simple as creating a recordset from the practice table at the top of the form then creating the rest of the form to upload to the reviews table, or is it more complicated than that? As always, your help is much appreciated.

Sign in to reply to this post

Jason ByrnesWebAssist

yeah, it look like the WADALocation variable is the one to use.


for the review page, create a recordset to pull the Practice ID and Practice name.

The Select list will use the Practice ID column for the value, and the practice Name column for the label.

Sign in to reply to this post

jeffmg279672

getting a parse error since adding second recordset

I've added a second recordset to my detail page to pull in whatever reviews exist for the specific practice, but when testing I'm now getting a parse error message, when testing locally, as follows:

Parse error: syntax error, unexpected ')', expecting T_STRING or T_VARIABLE or '$' in /Applications/MAMP/htdocs/goodvetguide/practice_Detail.php on line 78

line 78 is:

if (isset()) {

I've attached the page as a zip so that you can see it in context.

Attached Files
practice_Detail.php.zip
Sign in to reply to this post

Jason ByrnesWebAssist

you have not entered a run time value for the Parampractice_id parameter, you need to specify a run time value for any parameter you create.

Sign in to reply to this post

jeffmg279672

Sorry, I have no idea what you mean by a run time value - can you spell it out for me, please?

Sign in to reply to this post

Jason ByrnesWebAssist

Well, if you look at the Parampractice parameter, and edit it, you will see that there are 4 settings:
Name: Parampractice
Type: Integer
Default Value: -1
Runtime Value: $_GET['practice_id']

what this means is:
If a querystring variable is passed in named "practice_id", the Parampractice parameter is assigned that. Otherwise the default value is used.

Example:
access the page as:
practice_Detail.php?practice_id=23

will cause the parameter in the recordset to be assigned the value 23.

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...