CodeCharge Studio
search Register Login  

Visual PHP Web Development

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 custom insert problem - Catchable fatal error:

Print topic Send  topic

Author Message
idh63

Posts: 76
Posted: 01/22/2008, 6:41 PM

Hi Folks,

It's been a long time since I've used CCS3.x and I have my insert working fine in Zend Studio, but not in CCS.

I need to add a interest calculation on a specific trading day (the easy part).

Then I have created custom code to find all members who should earn interest on their deposit. (as I said above - I have this part working in Zend Studio)

post_results_events.php
$postings_ds_BeforeExecuteInsert = true  
 $Component = & $sender;   
$Container = & CCGetParentContainer($sender);   
  
global $postings; //Compatibility  
//End postings_ds_BeforeExecuteInsert   
//Custom Code @13-2A29BDB7  
// -------------------------   
  
// create list of members to create a new transaction LIMIT 300  
 	$limit = 300;  
             $result = array();   
             $process_date  = $postings->post_date;  
             echo $process_date;  
            $process_rate = $postings->post_rate;  
  
            $db = new clsDBConnection1();  
            $db->Debug=True;  
  
            while (isset($db->query("SELECT DISTINCT transaction.userid FROM transaction WHERE transaction.ex_date <=  DATE_SUB(" . $postings->post_date . ", INTERVAL 8 DAY) ORDER BY transaction.userid ASC LIMIT $limit")); {  
  
 	             while ($db->next_record())  
  		{  
    		//foreach ($results as $userid) {   
 		$sql = "SELECT sum(transaction.deposit) - sum(transaction.withdraw) AS balance FROM transaction WHERE transaction.ex_date <= " . $postings->post_date . " AND userid = $userid";  
  		$cur_balance = $db->query($sql);  
  		echo "Userid: " . $DBConnection1->f('userid');  
  		$sql = "INSERT INTO transaction (userid, ttype, status, deposit, req_date, ex_date) VALUES ($userid,3,2,(" . $postings->post_rate . "*$cur_balance)," . $postings->post_date . ",date_add( '$process_date', INTERVAL 8 DAY))";  
  		echo " $sql<br>";  
                             
  		//}  
  
  	}  
            $limit = ($limit + 300);  
       }

The error i get is: Catchable fatal error: Object of class clsControl could not be converted to string in C:\xampp\htdocs\project\admin\post_results_events.php on line 27

if i change my first $sql query from DATE_SUB(" . $postings->post_date . ", INTERVAL 8 DAY)
to...
DATE_SUB('2007-07-01', INTERVAL 8 DAY) just as a test date, the error goes away.
I also tried declaring the variable $process_date so I had...
DATE_SUB('$process_date', INTERVAL 8 DAY), but still the same error.

Any ideas appreciated.

Thanks
View profile  Send private message
DonB
Posted: 01/22/2008, 7:39 PM

$postings->post_date->GetValue();

--
DonB

http://ccswiki.gotodon.net


"idh63" <idh63@forum.codecharge> wrote in message
news:54796a9498503f@news.codecharge.com...
> Hi Folks,
>
> It's been a long time since I've used CCS3.x and I have my insert working
> fine
> in Zend Studio, but not in CCS.
>
> I need to add a interest calculation on a specific trading day (the easy
> part).
>
> Then I have created custom code to find all members who should earn
> interest on
> their deposit. (as I said above - I have this part working in Zend Studio)
>
> post_results_events.php
>
$postings_ds_BeforeExecuteInsert = true  
> $Component = & $sender;  
> $Container = & CCGetParentContainer($sender);  
>  
> global $postings; //Compatibility  
> //End postings_ds_BeforeExecuteInsert  
> //Custom Code @13-2A29BDB7  
> // -------------------------   
>  
> // create list of members to create a new transaction LIMIT 300  
>  $limit = 300;  
>             $result = array();  
>             $process_date  = $postings->post_date;  
>             echo $process_date;  
>            $process_rate = $postings->post_rate;  
>  
>            $db = new clsDBConnection1();  
>            $db->Debug=True;  
>  
>            while (isset($db->query("SELECT DISTINCT transaction.userid   
> FROM  
> transaction WHERE transaction.ex_date <=  DATE_SUB(" .   
> $postings->post_date . ",  
> INTERVAL 8 DAY) ORDER BY transaction.userid ASC LIMIT $limit")); {  
>  
>               while ($db->next_record())  
>  {  
>    //foreach ($results as $userid) {  
>  $sql = "SELECT sum(transaction.deposit) - sum(transaction.withdraw) AS  
> balance FROM transaction WHERE transaction.ex_date <= " .   
> $postings->post_date .  
> " AND userid = $userid";  
>  $cur_balance = $db->query($sql);  
>  echo "Userid: " . $DBConnection1->f('userid');  
>  $sql = "INSERT INTO transaction (userid, ttype, status, deposit,   
> req_date,  
> ex_date) VALUES ($userid,3,2,(" . $postings->post_rate . "*$cur_balance),"   
> .  
> $postings->post_date . ",date_add( '$process_date', INTERVAL 8 DAY))";  
>  echo " $sql<br>";  
>  
>  //}  
>  
>  }  
>            $limit = ($limit + 300);  
>       }
>
> The error i get is: Catchable fatal error: Object of class clsControl
> could not
> be converted to string in
> C:\xampp\htdocs\project\admin\post_results_events.php on line 27
>
> if i change my first $sql query from DATE_SUB(" . $postings->post_date .
> ",
> INTERVAL 8 DAY)
> to...
> DATE_SUB('2007-07-01', INTERVAL 8 DAY) just as a test date, the error goes
> away.
> I also tried declaring the variable $process_date so I had...
> DATE_SUB('$process_date', INTERVAL 8 DAY), but still the same error.
>
> Any ideas appreciated.
>
> Thanks
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

idh63

Posts: 76
Posted: 01/22/2008, 8:02 PM

Hi Don,

Doh Doh Doh DOH doh !!

I remember now. It's been a long time since i used these classes and functions.

Thanks so much.
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.