首页 > 解决方案 > 在 ColdFusion 中更新数据库

问题描述

我有一个 ColdFusion 表单,我想更新我的数据库。我正在使用记录 ID,但是有一个问题。当我输入 url - localhost:8500/elephant_shack/update.cfm?record_id=1 时,我进入了 for,但没有使用表单。我是一个完全新手,迷路了!

任何帮助都会很棒:)

<!--- form--->
<cfquery name="GetRecordtoUpdate" datasource="elephant_shack">
        SELECT *
         FROM Richard
         WHERE record_id = #URL.record_id#
</cfquery>


<table>
<cfoutput query= "GetRecordtoUpdate">
<form action="update_action.cfm" method="Post">

   <tr>
    <td width="93">record id:</td> 
    <td width="286"><input name="record_id" type="text" value="#record_id#" size="25"></td>
</tr>
<tr>
    <td width="93">Item:</td> 
    <td width="286"><input name="item" type="text" value="#item#" size="25"></td>
</tr>

<tr>
    <td>Stock:</td>
    <td><input name="stock" type="text" value="#stock#" size="12"></td>
</tr>
    <tr>
    <td>Par:</td>
    <td><input name="par" type="text" value="#par#" size="12"></td>
</tr>
<tr>
    <td>Order:</td>
    <td><input name="order" type="text" value="#order#" size="50"></td>
</tr>


<tr>
    <td>&nbsp;</td>
    <td><input type="Submit" value="Update Information"></td>
</tr>
</form>
    </cfoutput>
</table>

此外,数据库未更新。

<!--- update form--->
<cfupdate datasource="elephant_shack" tablename="Richard">

标签: mysqlcoldfusion

解决方案


推荐阅读