CodeCharge Studio
search Register Login  

Visual Web Reporting

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

YesSoftware Forums -> Archive -> GotoCode Archive

 Get all the row values

Print topic Send  topic

Author Message
Vincent
Posted: 09/30/2002, 10:35 AM

I am using the following to print all the records from the database but it only returns the last one (Before Show event)! What is wrong with this code? I am using CC2.0.5 with PHP.

$sSQLtemp = "select statement from compete_behaviours WHERE competence_id=" . $comp_id2 . " AND client_id=" . $cID ;
$db->query($sSQLtemp);
while ($db->next_record())
{
$comp2_behave = $db->f("statement");
echo $comp2_behave;
}

Thank you!
Vincent
Nicole
Posted: 10/03/2002, 12:39 AM

Hello,
the code looks correct. Have you tried to execute it on the clean CC page with predefined values? Does it work?
Vincent
Posted: 10/03/2002, 11:17 PM

Thank you Nicole,
This code works now (open form event). But how do I put the values of $comp2_behave into a field? When I assign this to a field, it only returns the last record...
Nicole
Posted: 10/07/2002, 5:43 AM

Vincent,
As I understand you mean grid form fields. They get the values in the loop, that’s why if you have executed the code in the form Before Show event you got only last value (the loop was executed several times inside another loop).
In case you’re sure that the number of records returned in recordset of custom query equals to number of records on the form you can:
1. open new connection and execute custom query in form Open event (new connection is need in order not to overwrite query result):
global $db;
$db_n = new DB_Sql();
$db_n->Database = $db->Database;
$db_n->User = $db->User;
$db_n->Password = $db->Password;
$db_n->Host = $db->Host;
$db_n->query(“custom_query”);
$db_n->next_record();

2. get the field value and move through recordset to the next record in the form before show event (inside CC loop):
echo $db_n->f(“field_name”);
$db_n->nect_record();
Vincent
Posted: 10/07/2002, 6:34 AM

Nicole,
Thank you, this is a big step forward. In fact, I would like to use this in a Record form, not a grid. How would this be accomplished then?
Vincent

   


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.