CodeCharge Studio
search Register Login  

Visual Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 How to add Date + 1 month

Print topic Send  topic

Author Message
travel-net

Posts: 56
Posted: 07/20/2004, 12:54 AM

Hello,

I have a record form with an Texbox and i wan't to display the following SQL code.

select date_add(NOW(), interval 1 month

How do i do that?

Using Mysql, php and apache.

Regards,
Frans

View profile  Send private message
Last Hero
Posted: 07/20/2004, 2:30 AM

http://www.php.net/manual/en/ref.datetime.php
Look comment from: mwedgwood at ILUVSPAMhotmail dot com
31-Mar-2002 01:24
travel-net

Posts: 56
Posted: 07/20/2004, 6:00 AM

Hello Last Hero,

I wan't to display the Sql value in a textbox on the record form. The sql query works, but i don't know how to display it in the textbox. The following code didn't work.

$klant_abonn_tbl->Textbox1->SetValue(CCGetDBValue("select date_add(NOW(), interval 1 month"),$DBConnection1));

Regards,
Frans
View profile  Send private message
Walter Kempees
Posted: 07/20/2004, 7:10 AM

In response:
If you want to display the SQL statement literally in the TextBox,
.................
Otherwise,
Create a Table in MySQl called "dual" excists of only one field "dummy"
varchar(1).
Then do your

select date_add(NOW(), interval 1 month) from dual;

in the proces add a ")"closing just after the word "month"

BTW 2004-08-20 16:09:38 is the outcome

Walter

"travel-net" <travel-net@forum.codecharge> schreef in bericht
news:540fd175e46eab@news.codecharge.com...
> Hello Last Hero,
>
> I wan't to display the Sql value in a textbox on the record form. The sql
query
> works, but i don't know how to display it in the textbox. The following
code
> didn't work.
>
> $klant_abonn_tbl->Textbox1->SetValue(CCGetDBValue("select date_add(NOW(),
> interval 1 month"),$DBConnection1));
>
> Regards,
> Frans
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Last Hero
Posted: 07/20/2004, 8:03 AM

1.I create new connection to Mysql database with name MySQL
2.create new record. put TextBox1 to this record. Select Type: Date, DBFormat: yyyy-mm-dd HH:nn:ss
3.In beforeShow event for this textbox add next custom code:

global $NewRecord1;
global $DBMySQL;
$date = CCGetDBValue("select date_add(NOW(), interval 1 month)",$DBMySQL);
$datearray = CCParseDate($date, Array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn", ":", "ss"));
$NewRecord1->TextBox1->SetValue($datearray);

And in LivePage i can sea now: 08/20/2004 6:04 PM
Last Hero
Posted: 07/20/2004, 8:04 AM

Sorry, you can leave DBFormat property empty
travel-net

Posts: 56
Posted: 07/20/2004, 8:18 AM

Hello Last Hero,

Thanks for your code! :-)

Regards,
Frans
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.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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