|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Problem updating duplicate records
guys, I have a CloseDate field in my database that gets populated with a parsed date from a website. When the database is empty and i insert my parsed data into the database, the CloseDate field is populated fine. However once the database is populated and i run the insert on duplicate update, the CloseDate field is populated with 0000-00-00. Why is the CloseDate field getting affected?
Here is my code: <cfquery name="insJobRecord2" datasource="job"> insert into advertisements (ref, Website, Description, Title, Salary, Location, Contract, CloseDate, IntDate) values (<cfqueryparam value="#Links2[i]#" cfsqltype="CF_SQL_VARCHAR">, <cfqueryparam value="#thisURL2#" cfsqltype="CF_SQL_VARCHAR">, <cfqueryparam value="#thisJD2#" cfsqltype="CF_SQL_LONGTEXT">, <cfqueryparam value="#thisTitle2#" cfsqltype="CF_SQL_VARCHAR">, <cfqueryparam value="#thisSalary2#" cfsqltype="CF_SQL_VARCHAR">, <cfqueryparam value="#thisLocation2#" cfsqltype="CF_SQL_VARCHAR">, <cfqueryparam value="#thisContract2#" cfsqltype="CF_SQL_VARCHAR">, <cfqueryparam value="#thisCloseDate2#" cfsqltype="CF_SQL_DATE">, <cfqueryparam value="#thisIntDate2#" cfsqltype="CF_SQL_VARCHAR">) on duplicate key update Description = '#thisJD2#', Title = '#thisTitle2#', Salary = '#thisSalary2#', Location = '#thisLocation2#', Contract = '#thisContract2#', CloseDate = '#thisCloseDate2#', IntDate = '#thisIntDate2#' </cfquery There are three of these queries, one for each parsed website. I have outputted the thisCloseDate variable for each and they all give me a closedate. However they are slightly different in there format . e.g. 23/05/2005 and 16 May 2005 |
|
#2
|
|||
|
|||
|
What database are you using? This might be a question to ask in a forum specific to that database, as I don't see any obvious reason why it would be resetting itself. As far as I know MySQL is the only DB that has "on duplicate key", so you might want to ask in the MySQL forum.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#3
|
|||
|
|||
|
Cheers Kiteless I already posted on MySQL, but I was just checking that it wasnt a CF problem.....thanks anyway
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Problem updating duplicate records |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|