티스토리 뷰
function array_to_field($array) {
$res = array(
'combine' => array(),
'field' => array(),
'value' => array()
);
foreach ($array as $key => $value) {
if($value === null) {
$value = 'null';
} else if(!in_array($value, array('NOW()'))) {
$value = "'" . addslashes($value) . "'";
}
array_push($res['combine'], "`{$key}` = {$value}");
array_push($res['field'], "`{$key}`");
array_push($res['value'], $value);
}
$res['combine'] = implode(', ', $res['combine']);
$res['field'] = implode(', ', $res['field']);
$res['value'] = implode(', ', $res['value']);
return $res;
}
'PHP & MySQL' 카테고리의 다른 글
웹 디버깅용 로그 출력 + Windows용 Tail.exe (0) | 2017.08.28 |
---|---|
Pagination (0) | 2017.08.23 |
실시간 압축 (0) | 2015.09.01 |
출력제어 (0) | 2015.08.28 |
크로스도메인 허용 (0) | 2015.07.02 |