Forum


22:10

25/11/2010

Hi, excuse my bad english.
I use a model edit but dont update the values.
the code is
js code
url:'abilita.php?q=1',
datatype: "xml",
colNames:['Partita Iva','Ragione Sociale', 'Utente','Indirizzo','Città','Cap','Provincia','Telefono','Email','Attivo','Cancellato'],
colModel:[
{name:'iva',index:'iva', width:110,editable:false,editoptions:{size:10}},
{name:'descrizione',index:'descrizione', width:110,editable:false,editoptions:{size:10}},
{name:'utente',index:'utente', width:90,editable:false,editoptions:{size:15}},
{name:'indirizzo',index:'indirizzo', width:110, align:"right",editable:false,editoptions:{size:10}},
{name:'citta',index:'citta', width:110, align:"right",editable:false,editoptions:{size:10}},
{name:'cap',index:'cap', width:40,align:"right",editable:false,editoptions:{size:10}},
{name:'provincia',index:'provincia', width:60,align:"right",editable:false,editoptions:{size:10}},
{name:'telefono',index:'telefono', width:90,align:"right",editable:false,editoptions:{size:10}},
{name:'email',index:'email', width:160,align:"right",editable:false,editoptions:{size:10}},
{name:'attivo',index:'attivo',width:55,align:'center',editable:true,edittype:"checkbox",editoptions:{value:"Yes:1;No:0"}},
{name:'cancellato',index:'cancellato',width:60,align:'center',editable:true,edittype:"checkbox",editoptions:{value:"Yes:1;No:0"}}
],
rowNum:10,
rowList:[10,20,30],
pager: '#pagernav',
sortname: 'iva',
viewrecords: true,
sortorder: "asc",
width: 690,
shrinkToFit: false,
height: "100%",
caption:"Utenti d'abilitare",
editurl:"abilitare.php"
});
jQuery("#navgrid").jqGrid('navGrid','#pagernav',{edit:true,add:false,del:false,search:false},
{}, //options
{height:'auto',reloadAfterSubmit:true}, // edit options
{height:540,reloadAfterSubmit:false}, // add options
{reloadAfterSubmit:false}, // del options
{} // search options
);
php code
include('../inc/db.php');
if (isset($_POST["oper"])) {
if ($_POST["oper"] == "add") {
} elseif ($_POST["oper"] == "edit") {
$editSQL = sprintf("update clienti set attivo = %s, cancellato = %s
where iva = %s and utente = %s",
GetSQLValueString($_POST['attivo'], "int"),
GetSQLValueString($_POST['cancellato'], "int"),
GetSQLValueString($_POST['iva'], "text"),
GetSQLValueString($_POST['utente'], "text"));
$Result = mysql_query( $editSQL ) or die("Couldn t execute query.".mysql_error());
} elseif ($_POST["oper"] == "del") {
$deleteSQL = sprintf("delete from users where idusers = %s",
GetSQLValueString($_POST['id'], "int"));
$Result = mysql_query($deleteSQL, $metrics) or die(mysql_error());
}
}
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
?>
Most Users Ever Online: 715
Currently Online:
59 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