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! |
 |
 |
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.... :)
|
 |
 |
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! |
 |
 |
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 |
 |
 |
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.... :)
|
 |
 |
mentecky
Posts: 321
|
| Posted: 02/11/2009, 7:58 PM |
|
Correct, excuse my typo. It is MONTH
Rick
_________________
http://www.ccselite.com |
 |
 |
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! |
 |
 |
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.... :)
|
 |
 |
|