jQuery UI Widgets Forums Grid Update operation not working

Tagged: , ,

This topic contains 1 reply, has 2 voices, and was last updated by  ivailo 9 years ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Update operation not working #72044

    drv232
    Participant

    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 ends
                
    

    console.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');
                    }
                 });
     
    Update operation not working #72060

    ivailo
    Participant
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.