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

 [SOLVED]custom insert dont work

Print topic Send  topic

Author Message
fabiokbca

Posts: 18
Posted: 02/27/2012, 8:57 AM

Hi guys;
My custom insert dont work.
It work one time but work no more.

function emprestimo_ds_BeforeExecuteUpdate(& $sender) {       
$emprestimo_ds_BeforeExecuteUpdate = true;      
 $Component = & $sender;       
$Container = & CCGetParentContainer($sender);       
global $emprestimo; //Compatibility //End emprestimo_ds_BeforeExecuteUpdate   
 //Custom Code @50-2A29BDB7  
 // -------------------------       
// Write your own code here.  
 // ------------------------- 	  
// ADICIONAR ANOTACAO 	 	  
$anotacao = $emprestimo->txtAnotacao->GetValue(); 	//die($anotacao);   
	if (trim($anotacao != "")){ 		  
$inserir = "INSERT INTO anotacoes (id_emprestimo, descricao, id_usuario, data_hora) VALUES ("; 		  
$inserir .= CCGetFromGet("id_emprestimo") . ","; 		  
$inserir .= "'". $anotacao . "',"; 		  
$inserir .= CCGetUserId() . ",'" . date("Y-m-d H:i:s") . "')"; 		//$inserir = mysql_query($inserir) or die(mysql_error());   
// WHY THIS LINE DONT WORK  WHEN MY PROJECT NOT IN LOCAL MACHINE?	  
	  
$db = new clsDBConnection1; 		  
$db->query($inserir); 		  
$db->close;    
}

Anybody can help me?
View profile  Send private message
Gena

Posts: 591
Posted: 02/27/2012, 9:17 AM

add code like
echo  $inserir;

to see what INSERT was generated, if sintax is correct....
_________________
Gena
View profile  Send private message
fabiokbca

Posts: 18
Posted: 02/27/2012, 9:54 AM

Hello Gena. Sintax is correct. See "die($inserir);"
I'm test the sql string in phpmyadmin and work correctly.
View profile  Send private message
fabiokbca

Posts: 18
Posted: 02/27/2012, 9:57 AM

I don't now what is happening. In a moment dont work, few minutes later work correctly with the same sql string. Code Charge make me crazy
View profile  Send private message
clahti2

Posts: 107
Posted: 02/27/2012, 3:37 PM

this sounds like it may be an uncaptured SQL exception, why don't you see if there is an SQL error, try something like (assuming MySQL):

die ("Query failed: " . mysql_error() . " Actual query: " . $query);
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.

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.