CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 CCS "SetValue" question

Print topic Send  topic

Author Message
Headhunter
Posted: 06/29/2003, 6:29 AM

CCS2.1 + PhP + MySQL + Linux

How do I set a value to a label from a multi row database result?
I have the following code, but the result is displayed on top of the page instead of Grid Label value:

global $DBcarportal;
global $cars;

function GetCarOptions()
{
global $DBcarportal;
global $cars;
$lang=CCGetParam("lang","");
$car=ccgetparam("car_id","");
$SQL = "SELECT tll_label, car_options.* FROM (tags INNER JOIN car_options ON car_options.tag_id = tags.tag_id) INNER JOIN tags_lbl ON tags_lbl.tll_tag_id = tags.tag_id WHERE prod_id = $car AND tll_lang_id = $lang";
$DBcarportal->query($SQL);
while($DBcarportal->next_record())
{
print $DBcarportal->f("tll_label") . ", ";
}
unset($DBcarportal);
}
$cars->tag_id->SetValue(GetCarOptions());

What am I doing wrong?
Thanks for your help.
mkmind
Posted: 06/29/2003, 11:26 PM

Hello.
Sorry about my english.
Put this into a array.
print $DBcarportal->f("tll_label") . ", ";

In the new Projectexamles (ManyToManyCheckbox) in an example.

global $employees_record;

$ArrayProject = array();
$ProjectConnection = null;

//Populate the multi-select project CheckBox list
if($employees_record->EditMode) {

//Create a new database connection object
$ProjectConnection = New clsDBIntranetDB();
$ProjectConnection->query("SELECT project_id FROM projects_employees WHERE emp_id =".$ProjectConnection->TOSql(CCGetParam("emp_id", 0),ccsInteger));
while($ProjectConnection->next_record()) {
array_push($ArrayProject,$ProjectConnection->f("project_id"));
}
$employees_record->ProjectList->Multiple = true;
$employees_record->ProjectList->Value = $ArrayProject;

//Close and destroy the recordset
unset($ProjectConnection);

}

mkmind
Headhunter
Posted: 06/30/2003, 11:27 AM

mkmind,

I wasn't able to make it work the way you stated, but I changed my code a bit and it works. It's maybe not the way to do it, but it works for me.

global $DBcarportal;
global $cars;

$lang=CCGetParam("lang","");
$car=ccgetparam("car_id","");
$SQL = "SELECT tll_label, car_options.* FROM (tags INNER JOIN car_options ON car_options.tag_id = tags.tag_id) INNER JOIN tags_lbl ON tags_lbl.tll_tag_id = tags.tag_id WHERE prod_id = $car AND tll_lang_id = $lang";
$DBcarportal->query($SQL);
while($DBcarportal->next_record())
{
$cars->car_options->SetValue($cars->car_options->GetValue() . " " . $DBcarportal->f("tll_label") . ", ");
}
unset($DBcarportal);

   


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

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


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