probe con esto pero nada.
Código PHP:
$post_array = Array('nombre' => 'Juan','apellido'=>'Cabrera','email'=>'[email protected]','edad' => '20');
$id = 10;
function getSetString($parray){
foreach($parray as $key => $value){
if(!empty ($value)){
if(is_numeric($value)){
$setArray[] = "$key = $value";
}else{
$setArray[] = "$key = '$value'";
}
}
}
return empty($setArray)? false: implode(', ',$setArray);
}
$setString = getSetString($post_array);
$sqlQuery = "UPDATE tabla SET {$setString} where id=$id";
echo $sqlQuery;