close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Two queries on same table

Thread began 11/28/2021 2:48 pm by birdscreen398247 | Last modified 11/29/2021 9:17 am by Ray Borduin | 119 views | 1 replies |

birdscreen398247

Two queries on same table

I have a table (Table1) with the following fields:

Name
Quantity
Date
Description

There are multiple records with the same name. For instance 3 Johns and 4 Smiths.

I want to display this data as follows in a table.

First line:
Name

Subsequent lines:
Date, Quantity, Description for each record with that name
With one line per each.

Then Name again
And then one line per each record with that name
Etc.

It would look like this:

John
10/5/21 5 Red buttons
11/6/21 3 Black Ties
Smith
09/5/21 8 Yellow curtains
12/6/21 2 Blue Pansies

My sql query is

<?php
$rsTable1 = new WA_MySQLi_RS("rsTable1 ",$siteguide2018,0);
$rsTable1 ->setQuery("SELECT * FROM Table1 ORDER BY Name");
$rsTable1 ->execute();
?>

Can I put another query using the same table in a sub-table like this?


<?php
$rslist = new WA_MySQLi_RS("rslist ",$siteguide2018,0);
$rslist ->setQuery("SELECT * FROM Table1 WHERE Name = ? ORDER BY Date");
$rslist ->bindParam("i", "".($rsTable1->getColumnVal("Name")) ."", "0");
$rslist ->execute();
?>

Or will having two open queries on the same table cause trouble?

Sign in to reply to this post

Ray BorduinWebAssist

It will not be a problem. I do it all the time. Copy and paste the second recordset into the repeat region to make sure it is updated for each row displayed.

Sign in to reply to this post
Did this help? Tips are appreciated...

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