jQuery UI Widgets › Forums › Grid › Update operation not working
This topic contains 1 reply, has 2 voices, and was last updated by ivailo 10 years, 8 months ago.
Viewing 2 posts - 1 through 2 (of 2 total)
-
Author
-
I have the following code that sends data to my php file when I select the update button
updaterow: function (rowid, rowdata, commit) { var data = "update=true&" + $.param(rowdata); console.log(data); $.ajax({ dataType: 'json', type: "POST", url: 'CurHold_data.php', data: data, success: function (data, status, xhr) { // update command is executed. commit(true); } }); }//updaterow ends };//var source endsconsole.log() logs the modified data correctly.
My php file is as follows:
<?php include('connect.php'); if (isset($_POST['update'])) { // UPDATE COMMAND $update_query = "UPDATE 'rep_cur_holdings' SET 'Description'='".$_POST['Description']."', 'OrigFace'='".$_POST['OrigFace']."', 'Factor'='".$_POST['Factor']."', 'CurrentFace'='".$_POST['CurrentFace']."', 'Mark'='".$_POST['Mark']."', 'MarketVal'='".$_POST['MarketVal']."', 'Sector'='".$_POST['Sector']."', 'SubSector'='".$_POST['SubSector']."', 'Strategy'='".$_POST['Strategy']."', 'Portfolio'='".$_POST['Portfolio']."' WHERE 'CUSIP'='".$_POST['CUSIP']."'"; $result=mysql_query($update_query) or die("SQL Error 1: " . mysql_error()); } else{ SELECT STATEMENT Code Goes here } ?>But as soon as I click the save button the data is reset in the grid and there is no change in the database.
$("#Save").click(function () { if (editrow >= 0) { var row = { Description: $("#Description").val(), CUSIP: $("#CUSIP").val(), OrigFace: $("#OrigFace").val(),Factor: $("#Factor").val(), CurrentFace: $("#CurrentFace").val(), Mark: $("#Mark").val(),MarketVal: $("#MarketVal").val(), Sector: $("#Sector").val(), SubSector: $("#SubSector").val(),Strategy: $("#Strategy").val(), Portfolio: $("#Portfolio").val()}; $('#jqxgrid').jqxGrid('updaterow', editrow, row); $("#EditFormulier").jqxWindow('hide'); } }); -
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.