Forum



13:01

07/06/2011

Hey,
I feel like such a noob for asking this, but I cannot seem to figure out how to save my edited row to my MySQL database.
Because I didn't want to clog this screen with code i've put up my code on pastebin.
Index.html | example.php | edit.php
Can anyone tell me what i'm doing wrong or forgetting? I already googled and checked out the wiki and examples but couldn't find a clear answer about what to do.
I hope my code is clear to read, if something is unclear, i'll be glad to help out.
00:10

22/06/2011

I am using the following pages to edit/delete inline (see below). I hope it helps.
sales.php
<script type="text/javascript">
$(function(){
$("#grps").jqGrid({
url:'dbConfig.php',
datatype: 'xml',
mtype: 'GET',
colNames:['','Sales Rep','Bill to Code', 'Activity Date','Customer','RFSI','EFMS','FLT','MX','Growth Plan'],
colModel :[
{name: 'myac', width:80, fixed:true, sortable:false, resize:false, formatter:'actions', formatoptions:{keys:true}},
{name:'repName', index:'repName', sortable:true, width:110, editable:true, search:true,stype:'text'},
{name:'code', index:'code', width:100, sortable:true, align:'center', editable:true, search:true,stype:'text'},
{name:'salesDate', index:'salesDate', width:100, sortable:true,align:'center', editable:true},
{name:'customer', index:'customer', width:200, align:'left', editable:true, search:true,stype:'text'},
{name:'RFSI', index:'RFSI', width:50, sortable:true,align:'center', editable:true,edittype:"checkbox",editoptions: {value:"X"}},
{name:'EFMS', index:'EFMS', width:60, sortable:true,align:'center', editable:true,edittype:"checkbox",editoptions: {value:"X"}},
{name:'FLT', index:'FLT', width:50, sortable:true,align:'center', editable:true,edittype:"checkbox",editoptions: {value:"X"}},
{name:'MX', index:'MX', width:50, sortable:true,align:'center', editable:true,edittype:"checkbox",editoptions: {value:"X"}},
{name:'comment', index:'comment', width:450, sortable:false, editable:true,edittype:"textarea", editoptions:{rows:"3",cols:"50"}}
],
pager: '#pgrps',
rowNum:15,
rowList:[10,25,50,100],
autowidth: true,
sortname: 'id',
sortorder: 'desc',
viewrecords: true,
width: "98%",
height: "100%",
editurl: "includes/inlineEdit.php",
caption: 'Action Plan List'
});
///////// Nav buttons /////////////////
jQuery("#grps").jqGrid('navGrid','#pgrps',{edit:false,add:false,del:false,search:true,refresh:true},
{},{},{},{multipleSearch:true});
});
</script>
<table id="grps"></table>
<div id="pgrps"></div>
editInline.php (short version)
/////// DELETE RECORD ////////////////////
if (($_POST['oper']) == "del") {
$deleteSQL = sprintf("DELETE FROM sales_call WHERE id=%s",
GetSQLValueString($_POST['id'], "int"));
mysql_select_db($database_intranet, $intranet);
$Result1 = mysql_query($deleteSQL, $intranet) or die(mysql_error());
}
/////// UPDATE RECORD ////////////////////
if (($_POST['oper']) == "edit") {
$updateSQL = sprintf("UPDATE sales_call SET repName=%s, code=%s, salesDate=%s, customer=%s, RFSI=%s, EFMS=%s, FLT=%s, MX=%s, comment=%s WHERE id=%s",
GetSQLValueString($_POST['repName'], "text"),
GetSQLValueString($_POST['code'], "text"),
GetSQLValueString($_POST['salesDate'], "date"),
GetSQLValueString($_POST['customer'], "text"),
GetSQLValueString($_POST['RFSI'], "text"),
GetSQLValueString($_POST['EFMS'], "text"),
GetSQLValueString($_POST['FLT'], "text"),
GetSQLValueString($_POST['MX'], "text"),
GetSQLValueString($_POST['comment'], "text"),
GetSQLValueString($_POST['id'], "int"));
mysql_select_db($database_intranet, $intranet);
$Result1 = mysql_query($updateSQL, $intranet) or die(mysql_error());
}
?>
Most Users Ever Online: 715
Currently Online:
62 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66