CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 sorry

Print topic Send  topic

Author Message
adorni

Posts: 120
Posted: 02/01/2012, 12:03 PM

I sorry... "testing" is the table 2. Thanks. Where in the script i read "COLUMN1" from x primary key?

Very very thanks
View profile  Send private message
clahti2

Posts: 107
Posted: 02/15/2012, 10:09 PM

huh? Can you be more specific?
View profile  Send private message
clahti2

Posts: 107
Posted: 02/15/2012, 10:11 PM

oh never mind, I found the post that this was supposed to be attached to. YesSoftware, you may have a problem with child posts appearing as primary posts in the forum :-)
View profile  Send private message
adorni

Posts: 120
Posted: 02/16/2012, 4:00 AM

i need to UPDATE a table after INSERT in another table.

For example, i have a record form with:

Number: XXXXXX

I need after this insert, UPDATE in another table, the record wih XXXXXX.

Thanks

View profile  Send private message
mor

Posts: 119
Posted: 02/16/2012, 6:53 AM

You can add DLookup action to "After Insert" event for record. Or create block of Custom Code to the same place.

_________________
Mor ve Ötesi
View profile  Send private message
adorni

Posts: 120
Posted: 02/17/2012, 3:51 AM

Is possible that you write the PHP cde for this??? I don´t understand php so much :)

Thanks
View profile  Send private message
andy


Posts: 183
Posted: 02/19/2012, 10:25 AM

Here is an example of how to get form values, assign them to variables and then update a table with these variables.

This example is in a Record's After Update event:

global $DBConnection1;  
global $myrecord;  
  
//Get values and set variables  
$VPhone = $myrecord->Phone->GetValue();  
$VMobile = $myrecord->Mobile->GetValue();  
$VAltPhone = $myrecord->AltPhone->GetValue();  
$VFax = $myrecord->Fax->GetValue();  
$VEmail = $myrecord->Email->GetValue();  
$VStreet = $myrecord->Street->GetValue();  
$VCity = $myrecord->City->GetValue();  
$VCounty = $myrecord->County->GetValue();  
$VPostCode = $myrecord->PostCode->GetValue();  
$Vcountry_id = $myrecord->country_id->GetValue();  
  
$db = new clsDBConnection1();  
$sqlupdate = "UPDATE contact SET Phone=".CCToSQL($VPhone,ccsText)  
.", Mobile=".CCToSQL($VMobile,ccsText)  
.", AltPhone=".CCToSQL($VAltPhone,ccsText)  
.", Fax=".CCToSQL($VFax,ccsText)  
.", Email=".CCToSQL($VEmail,ccsText)  
.", Street=".CCToSQL($VStreet,ccsText)  
.", City=".CCToSQL($VCity,ccsText)  
.", County=".CCToSQL($VCounty,ccsText)  
.", PostCode=".CCToSQL($VPostCode,ccsText)  
.", country_id=".CCToSQL($Vcountry_id,ccsInteger)  
." WHERE cont_id=".CCToSQL(CCGetSession("UserID"),ccsInteger);  
$db->query($sqlupdate);  
$db->close();  

A few notes:
CCToSQL(variable, datatype) is used to ensure CodeCharge properly handles the variables within an SQL statement.
Obviously you will have to adapt this but hopefully demonstrates how to do a custom UPDATE

Good luck
_________________
Andy

RAD tools for rich UI controls:
http://www.koolphptools.com
View profile  Send private message
clahti2

Posts: 107
Posted: 02/19/2012, 3:50 PM

hmmm, this is a bit different syntax, documentation uses the $db-ToSQL([item],[type]. Also I am not sure why you are setting variables, you can just get the values directly, so this should also work:

  
  
global $DBConnection1;    
global $myrecord;    
    
//Get values and set variables    
$db = new clsDBConnection1();    
$sqlupdate = "UPDATE contact SET"  
."  Phone=".$db->ToSQL($myrecord->Phone->GetValue(),ccsText)    
.", Mobile=".$db->ToSQL($myrecord->Mobile->GetValue(),ccsText)    
.", AltPhone=".$db->ToSQL($myrecord->AltPhone->GetValue(),ccsText)    
.", Fax=".$db->ToSQL($myrecord->Fax->GetValue(),ccsText)    
.", Email=".$db->ToSQL($myrecord->Email->GetValue(),ccsText)    
.", Street=".$db->ToSQL($myrecord->Street->GetValue(),ccsText)    
.", City=".$db->ToSQL($myrecord->City->GetValue(),ccsText)    
.", County=".$db->ToSQL($myrecord->County->GetValue(),ccsText)    
.", PostCode=".$db->ToSQL($myrecord->PostCode->GetValue(),ccsText)    
.", country_id=".$db->ToSQL($myrecord->country_id->GetValue(),ccsInteger)    
." WHERE cont_id=".$db->ToSQL(CCGetSession("UserID"),ccsInteger);    
$db->query($sqlupdate);    
$db->close();  
  

Is there a compelling reason to set variables instead of GetValue() in the building of the SQL statement? Just curious.
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.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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