thanks but already been there.. done that

in access i would set the db asa date/time and use either Now() or Date()
as the default and it was fine but mysql when i do that enters the words
not the values

however, i didnt know that reserve words mattered in variables to, i
thought it was just the db field names themselfs, are u sure bout that?
doesnt seem right to me.

im using the field as an int because it works with the php (choke) date
inserts using time()

that example i put up was just the last 1 i tried. i looked on google and
didnt find an answer but saw some stuff about how it goes into the db must
be a certain way.

but u'd think it wouldnt be a problem to just set the now() variable and
insert it but its choking. u'd think it would be a snap maybe its just my
ghost in the machine again






> Couple of things...
>
> [EMAIL PROTECTED] wrote:
>> <cfset date=#Now()#>
>>
> Avoid using reserved words for variable names - date is a reserved word.
>
>   Use something like thisDate instead.  Plus you only need :
> <cfset thisDate = Now()>
>
>
>> <!--- do insert now --->
>> <CFQUERY NAME="qnews" DATASOURCE="#dsn#" USERNAME="#un#"
>> PASSWORD="#pw#">
>>     INSERT INTO guide (title, content, update)
>>              VALUES ('#title#', '#content#', '#date#' )
>> </CFQUERY>
>>
>
> In your database use a date or datetime field for the "update" field.
> This is what you should be using in Access as well.  When you've done
> this you won't need quotes around date field data. You also don't need
> quotes around numeric values either.  Your query will look like this :
>
> <CFQUERY NAME="qnews" DATASOURCE="#dsn#" USERNAME="#un#"
> PASSWORD="#pw#">
>     INSERT INTO guide (title, content, update)
>     VALUES ('#title#', '#content#', #thisDate#)
> </CFQUERY>
>
> You could also just use now() directly in the query
>
> <CFQUERY NAME="qnews" DATASOURCE="#dsn#" USERNAME="#un#"
> PASSWORD="#pw#">
>     INSERT INTO guide (title, content, update)
>     VALUES ('#title#', '#content#', #now()#)
> </CFQUERY>
>
>
> Hope this helps.
>
> Regards
>
> Stephen
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to