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

 I need to add one month to the field

Print topic Send  topic

Author Message
MSosnovski

Posts: 8
Posted: 02/11/2009, 11:12 AM

Hello,

I need to add one month to the field "TextBox7"


$db = new clsDBefigieweb();
$SQL = 'INSERT INTO financeiro (datalanc_financ, datavcto_financ, vlr_financ, inscricao_financ_fk, hist_financ, email_financ) VALUES (' . $db->ToSQL(date("Y-m-d H:i:s"), ccsDate) . ', ' . $db->ToSQL($TextBox7, ccsDate) . ', ' . $financeiro1->vlr_financ->GetValue(). ', ' . $financeiro1->inscricao_financ_fk->GetValue() . ', ' . $db->ToSQL($hist_financ, ccsText) . ', ' . $db->ToSQL($TextBox1, ccsText) .')';
$db->query($SQL);
}

Thank you!

_________________
PHP 5.x + MySQL 5.x + Linux
Brasil!
View profile  Send private message
damian

Posts: 838
Posted: 02/11/2009, 1:19 PM

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

many, many date functions that you can use to do this....
_________________
if you found this post useful take the time to help someone else.... :)
View profile  Send private message
MSosnovski

Posts: 8
Posted: 02/11/2009, 4:01 PM

Hello,

$SQL = 'INSERT INTO financeiro (datalanc_financ, datavcto_financ, vlr_financ, inscricao_financ_fk, hist_financ, email_financ) VALUES (' . $db->ToSQL(date("Y-m-d H:i:s"), ccsDate) . ', ' . $db->ToSQL($TextBox7("Y-m-d H:i:s"), ccsDate) . ', ' . $financeiro1->vlr_financ->GetValue(). ', ' . $financeiro1->inscricao_financ_fk->GetValue() . ', ' . $db->ToSQL($hist_financ, ccsText) . ', ' . $db->ToSQL($TextBox1, ccsText) .')';


Changed the code and got the following feedback:

Fatal Error: Call to undefined function 2009-02-11()

I must be missing in the syntax, can someone help me, I see the MYSQL Documents;

Thanks
_________________
PHP 5.x + MySQL 5.x + Linux
Brasil!
View profile  Send private message
mentecky

Posts: 321
Posted: 02/11/2009, 4:41 PM

Quote MSosnovski:
Hello,

I need to add one month to the field "TextBox7"


$db = new clsDBefigieweb();
$SQL = 'INSERT INTO financeiro (datalanc_financ, datavcto_financ, vlr_financ, inscricao_financ_fk, hist_financ, email_financ) VALUES (' . $db->ToSQL(date("Y-m-d H:i:s"), ccsDate) . ', ' . $db->ToSQL($TextBox7, ccsDate) . ', ' . $financeiro1->vlr_financ->GetValue(). ', ' . $financeiro1->inscricao_financ_fk->GetValue() . ', ' . $db->ToSQL($hist_financ, ccsText) . ', ' . $db->ToSQL($TextBox1, ccsText) .')';
$db->query($SQL);
}

Thank you!


Try:
$SQL = 'INSERT INTO financeiro (datalanc_financ, datavcto_financ, vlr_financ, inscricao_financ_fk, hist_financ, email_financ) VALUES (' . $db->ToSQL(date("Y-m-d H:i:s"), ccsDate) . ', DATE_ADD(' . $db->ToSQL($TextBox7, ccsDate) . ', INTERVAL 1 MONTHS), ' . $financeiro1->vlr_financ->GetValue(). ', ' . $financeiro1->inscricao_financ_fk->GetValue() . ', ' . $db->ToSQL($hist_financ, ccsText) . ', ' . $db->ToSQL($TextBox1, ccsText) .')';  
$db->query($SQL);  
}  

Rick
_________________
http://www.ccselite.com
View profile  Send private message
damian

Posts: 838
Posted: 02/11/2009, 7:45 PM

or better yet <snip>INTERVAL 1 MONTH</end snip> - lose the S at the end of Month (i think!)

_________________
if you found this post useful take the time to help someone else.... :)
View profile  Send private message
mentecky

Posts: 321
Posted: 02/11/2009, 7:58 PM

Correct, excuse my typo. It is MONTH

Rick
_________________
http://www.ccselite.com
View profile  Send private message
MSosnovski

Posts: 8
Posted: 02/12/2009, 9:40 AM

Dear Friends, thank you!

More amazing when you can not see, had already used the function DATE_ADD,
but not with the correct syntax!

Simple syntax.
_________________
PHP 5.x + MySQL 5.x + Linux
Brasil!
View profile  Send private message
damian

Posts: 838
Posted: 02/12/2009, 12:23 PM

at least half of all date issues are date format the rest are syntax or choosing right function
_________________
if you found this post useful take the time to help someone else.... :)
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.