<?php
require('global.php');
$type = 'content ';

$sql = 'SELECT * FROM '.$db_tablepre.$type;
$result =  sql_return($sql);


while ($row = sql_return($result,'FetchRow')) {
	$chk_id = false;
	$sql_up = '';
	foreach ($row as $key => $value){
		if ($key===0) $chk_id = true;
		elseif ($chk_id == true) {
			$top_id[0] = $key;
			$top_id[1] = $value;
			$chk_id = false;
		}
		elseif (!is_int($key)){
			if (strlen($value)<=3 && strlen($value)>0) $sql_up .= $key."=".$value.",";
			else $sql_up .= $key."='".$value."',";
			unset($row[$key]);
		}
		else unset($row[$key]);

	}
	$sql_up =substr($sql_up,0,-1);
	$sql ="UPDATE ".$db_tablepre.$type." SET ".$sql_up." WHERE ".$top_id[0]."=".$top_id[1];
	//var_dump($sql);exit;
	//sql_return("SET  NAMES   'utf8'") && sql_return($sql);
}

?>