muhammad shahid
04-30-2008, 09:32 AM
i am facing problem when try to post data some fields are updated but 2 fields are not updated.
this is stored procedur
UPDATE dbo.categories SET
[name]=@name,
[desc]=@desc,
picturepath=@picturepath,
title=@title,
published=@published,
deleted=@deleted,
parentid=@parentid
WHERE [id]=@id
php coding here
function updateCategoryDetails($valuesArray){
echo "updating";
try{
$this->arrValues = $valuesArray;
$sp=" update dbo.categories set ".$this->arrUpdate[1]."='".$this->arrValues[1]."',[";
$sp.=$this->arrUpdate[2]."]='".$this->arrValues[2]."',";
$sp.=$this->arrUpdate[3]."='".$this->arrValues[3]."',";
$sp.=$this->arrUpdate[4]."='".$this->arrValues[4]."',";
$sp.=$this->arrUpdate[5]."=".$this->arrValues[5].",";
$sp.=$this->arrUpdate[6]."=".$this->arrValues[6].",";
$sp.=$this->arrUpdate[7]."=".$this->arrValues[7];
$sp.=" where ".$this->arrUpdate[0]."=".$this->arrValues[0];
echo "sp==".$sp;
echo "<br>";
$sp = mssql_query($sp,$this->con );
mssql_close($this->con);
$this->errMsg = "Selected Brand updated successfully.";
}
catch(Exception $ex)
{
$this->errMsg = "Brand updation failed! ".$ex;
}
}
this is stored procedur
UPDATE dbo.categories SET
[name]=@name,
[desc]=@desc,
picturepath=@picturepath,
title=@title,
published=@published,
deleted=@deleted,
parentid=@parentid
WHERE [id]=@id
php coding here
function updateCategoryDetails($valuesArray){
echo "updating";
try{
$this->arrValues = $valuesArray;
$sp=" update dbo.categories set ".$this->arrUpdate[1]."='".$this->arrValues[1]."',[";
$sp.=$this->arrUpdate[2]."]='".$this->arrValues[2]."',";
$sp.=$this->arrUpdate[3]."='".$this->arrValues[3]."',";
$sp.=$this->arrUpdate[4]."='".$this->arrValues[4]."',";
$sp.=$this->arrUpdate[5]."=".$this->arrValues[5].",";
$sp.=$this->arrUpdate[6]."=".$this->arrValues[6].",";
$sp.=$this->arrUpdate[7]."=".$this->arrValues[7];
$sp.=" where ".$this->arrUpdate[0]."=".$this->arrValues[0];
echo "sp==".$sp;
echo "<br>";
$sp = mssql_query($sp,$this->con );
mssql_close($this->con);
$this->errMsg = "Selected Brand updated successfully.";
}
catch(Exception $ex)
{
$this->errMsg = "Brand updation failed! ".$ex;
}
}