我有一個CFC,它在工作發佈網站上處理「聯繫我們」類型的表單。 cfc旨在處理來自網站的幾種不同形式;一個通用的'聯繫我們'表格和另一個'我對這份工作感興趣'的表格。CFC中的通信故障鏈接與查詢
當CFC獲取數據,並且工作發佈的ID#在參數中時,CFC將執行快速查詢並抓取工作發佈信息,將其包含在電子郵件中併發送給HR部門和用戶包含工作發佈信息的電子郵件以及用戶的聯繫信息。
如果未檢測到ID,CFC只會向用戶發送確認電子郵件並將聯繫信息發送給HR部門。
處理通用(非ID)表單時,所有表現都很好。但是,當談到時間來處理,其中包括快速查詢我得到一個錯誤的形式:
Communications link failure The last packet successfully received from the server was 61,380 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.
爲什麼是填充我的頁面做工精細,但這CFC拋出一個錯誤,在其查詢查詢?
我們在共享主機環境下運行帶有MYSQL的CF9。
的CFC ...
<cfif len(local.data.job_id)>
<cftry>
<cfquery name="qJobsforEmail" datasource="#application.datasource#" username="#application.username#" password="#application.password#">
SELECT * FROM #local.data.table# WHERE #local.data.table#.#local.data.column#= <cfqueryparam value="#local.data.job_id#" cfsqltype="cf_sql_numeric">
</cfquery>
<cfcatch type="any">
<cfmail to="[email protected]" from="[email protected]" subject="Error processing query" type="html">
<h3>There was an error processing the query</h3>
<p><cfoutput>#cfcatch.Detail#</cfoutput></p>
<p><cfoutput>#cfcatch.NativeErrorCode#</cfoutput></p>
<p><cfoutput>#cfcatch.SQLState#</cfoutput></p>
<p><cfoutput>#cfcatch.Sql#</cfoutput></p>
<p><cfoutput>#cfcatch.queryError#</cfoutput></p>
<p><cfoutput>#cfcatch.where#</cfoutput></p>
<p><cfoutput>#cfcatch.type#</cfoutput></p>
<cfdump var="#local#">
</cfmail>
<cfset local.response["error"] = 'true'>
<cfset local.response["message"] = 'Error message to the page goes here...'>
<cfreturn local.response>
<cfabort>
</cfcatch>
</cftry>
<cftry>
<cfmail to="#local.data.email#" bcc="[email protected]" from="[email protected]" subject="Thank you for contacting us" type="html">
<h2>We’re glad you contacted us.</h2>
<p>Warm and fuzzy thank you message here</p>
<p>We received the following information on <cfoutput>#DateFormat(Now())#</cfoutput>, <cfoutput>#TimeFormat(Now())#</cfoutput>: </p>
<p>First Name: <cfoutput>#local.data.first_name#</cfoutput></p>
<p>Last Name: <cfoutput>#local.data.last_name#</cfoutput></p>
<cfif len(local.data.suffix)>
<p>Suffix: <cfoutput>#local.data.suffix#</cfoutput></p>
</cfif>
<p>Specialty: <cfoutput>#local.data.specialty#</cfoutput></p>
<p>Email Address: <cfoutput>#local.data.email#</cfoutput></p>
<p>Phone: <cfoutput>#local.data.phone#</cfoutput></p>
<p> Current City and State: <cfoutput>#local.data.city#</cfoutput></p>
<cfif len(local.data.comments)>
<p>Message: <cfoutput>#local.data.comments#</cfoutput></p>
</cfif>
<p style="border-top:thin dotted black;padding-top:20px;font-weight:bold;">This is the position you’re inquiring about:</p>
<p style="font-weight:bold;"><cfoutput>#qJobsforEmail.title#</cfoutput></p>
<p style="padding-bottom:20px;"><cfoutput>#qJobsforEmail.description#</cfoutput></p>
<p>Our Recruiter will review this information and get in touch with you as soon as possible. Please make sure your email or phone number listed above is correct.</p>
<p>Thanks again for contacting us. We look forward to speaking with you soon.</p>
</cfmail>
<cfcatch type="any">
<cfmail to="[email protected]" from="[email protected]" subject="Error processing email" type="html">
<h3>There was an error processing the email at</h3>
<cfdump var="#cfcatch.Detail#">
<cfdump var="#local#">
</cfmail>
<cfset local.response["error"] = 'true'>
<cfset local.response["message"] = 'message to return to the page...'>
<cfreturn local.response>
<cfabort>
</cfcatch>
</cftry>
<cfelse>
<!-- regular ol form process goes here -->
</cfif>
+1 - 的建議,這不是一個代碼錯誤,但比照服務器的配置和數據庫。 – Nate
我喜歡這個地方。謝謝。謝謝。在我打電話給我的主人並要求他們進行調查之後,我將停止將我的頭撞向桌子並開始清理血液。 – Ofeargall
另外,讓Pete Freitag說「我認爲這不是你的代碼的問題」,就像是一個黃金郵票驗證。讓我感到內心溫暖和快樂。 – Ofeargall