更新操作在Php MySQL数据库中不起作用

时间:2015-05-17 18:30:40

标签: php mysql

我正在学习php和MySql数据库。我正在尝试制作工资管理软件。在我的数据库中插入&删除操作正在执行,但我在更新操作中遇到问题。这是我的PHP脚本:

INSERT INTO temporarytransaction (Tid,T_type,Amount,Tdate,accountNo)
SELECT Tid,T_type,Amount,Tdate,accountNo 
FROM Transaction 
WHERE `Tdate` BETWEEN "2012-03-15" AND "2016-03-31"

如果我的问题得到解决,我将非常感激。

1 个答案:

答案 0 :(得分:-1)

为什么在WHERE之前有a)?

       <asp:GridView ID="grdAccidentMaster" runat="server" AutoGenerateColumns="False"
        Width="80%" BackColor="White" BorderColor="#DEDFDE" BorderStyle="Solid" BorderWidth="1px"
        EmptyDataText="No Records found" CellPadding="4" ForeColor="Black" GridLines="Both"
        DataKeyNames="IncidentNo" OnRowDataBound="grdAccidentMaster_RowDataBound">
        <Columns>
            <asp:BoundField DataField="IncidentNo" HeaderText="IncidentNo" />
            <asp:BoundField DataField="CreatedDate" HeaderText="Created Date" />
            <asp:BoundField DataField="AccidentDate" HeaderText="Accident Date" />
            <asp:BoundField DataField="PoliceStation" HeaderText="Police Station" />
            <asp:BoundField DataField="City" HeaderText="City Name" />
            <asp:BoundField DataField="RoadCondition" HeaderText="Road Condition" />
            <asp:BoundField DataField="RoadFeature" HeaderText="Road Feature" />  
            <asp:TemplateField HeaderText="Print">
             <ItemTemplate>
            <asp:Button runat="server" Text="Click" ID="btnClick" OnClick="btnPrint_click" />
             </ItemTemplate>
            </asp:TemplateField>
         </Columns>
    </asp:GridView>

试试这个:

Update users SET username = $name, email = $email , address = $address , contactinfo = $contactinfo) WHERE id = $id");

但是,我需要提醒您,这不是一个好的编程方法,您需要在了解基本查询概念后学习如何使用PDO。 http://php.net/manual/en/book.pdo.php