CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 MSSQL Array

Print topic Send  topic

Author Message
houselmill

Posts: 6
Posted: 12/31/2009, 11:53 AM

Greetings,

Working with CCS 4x, MSSQL 2005, PHP 5x

Have record form on page to enter client data. Now would like to display data (entered elsewhere) from another related table within the client record (client family members). Was thinking best approach would be to create 10 rows on record form(there is a max of 10 related records in related table) and use panels to control whether or not row is displayed based on data in row. I was assuming I would execute a query that would return the results in an Array; set the values for the labels based on the data in the Array, and hide/show the rows accordingly. Problem is I can't figure out how to access the results of the query in order to assign them to the labels.

Any help would be appreciated.

Thanks,

Charles
View profile  Send private message
datadoit
Posted: 12/31/2009, 11:59 AM

Charles how about just populating your array with the appropriate HTML
tags for the rows/columns?

ie: If data row {
$array = "<tr><td>$data</td></tr>";
}
houselmill

Posts: 6
Posted: 12/31/2009, 3:55 PM

Hi datadoit,

Thanks for responding. I saw your other response to post_id=109370 and was hoping you would jump in on this.

Anyway, the notion of populating the array with the appropriate HTML makes sense but I think I am actually even one step back. I don't know how to return the data (if that's the right term). In other words, I can construct and execute the select statement but I don't know how to get the data back. Sorry for such a basic problem -- odd, but I've only every dealt with custom inserts, updates, and deletes.

Thanks,

Charles

View profile  Send private message
datadoit
Posted: 01/01/2010, 8:04 AM

You'll do something like this in your label's BeforeShow (make sure the
label's content is set to HTML, not Text):

$TheGoods = "<table>";
$db = new clsDBYourConnection();
$SQL = "SELECT yada yada";
$db->query($SQL);
while ($db->next_record()) {
$TheGoods .= "<tr><td>" . $db->f("YourField") . "</td></tr>";
}
$db->close();
$TheGoods .= "</table>";
houselmill

Posts: 6
Posted: 01/01/2010, 11:13 AM

Thanks datadoit. I'll give it a shot and get back to you.
View profile  Send private message
houselmill

Posts: 6
Posted: 01/03/2010, 1:18 PM

Hey Datadoit,

I've got it working for the single field. To add fields, would I simply add the necessary additional code to display the second fields? For example:

$TheGoods .= "<tr><td>" . $db->f("YourField") . "</td><td>".$db->f("MySecondField")."</td></tr>";

I suspect there is a better way to do it to avoid all of the HTML definition. Was this what you were getting at with your initial response? If so can you elaborate on that piece? Specifically, how would I display all of the data from the query results (as opposed to a single field using the "f" method)?

Thanks,

Charles
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.