$vip ); $db->autoExecute($fdyu->table('oa_vip'),$fiel"/> $vip ); $db->autoExecute($fdyu->table('oa_vip'),$fiel">
$vip ); $db->autoExecute($fdyu->table('oa_vip'),$fiel" />
<br /><?php<br /><br />$vip='0004956321';<br /><br />$field_values_vip = array(<br />"vip" => $vip<br />);<br />autoExecute('table',$field_values_vip);<br /><br /><br />function autoExecute($table, $field_values, $mode = 'INSERT', $where = '', $querymode = '')<br /> {<br /> #$field_names = $this->getCol('DESC ' . $table);<br /> $field_names = array('vip');<br /><br /> $sql = '';<br /> if ($mode == 'INSERT')<br /> {<br /> $fields = $values = array();<br /> foreach ($field_names AS $value)<br /> {<br /> if (array_key_exists($value, $field_values) == true)<br /> {<br /> $fields[] = $value;<br /> $values[] = "'" . $field_values[$value] . "'";<br /> }<br /> }<br /><br /> if (!empty($fields))<br /> {<br /> $sql = 'INSERT INTO ' . $table . ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')';<br /> }<br /> }<br /> else<br /> {<br /> $sets = array();<br /> foreach ($field_names AS $value)<br /> {<br /> if (array_key_exists($value, $field_values) == true)<br /> {<br /> $sets[] = $value . " = '" . $field_values[$value] . "'";<br /> }<br /> }<br /><br /> if (!empty($sets))<br /> {<br /> $sql = 'UPDATE ' . $table . ' SET ' . implode(', ', $sets) . ' WHERE ' . $where;<br /> }<br /> }<br /><br /> echo $sql;<br /><br /> /*if ($sql)<br /> {<br /> return $this->query($sql, $querymode);<br /> }<br /> else<br /> {<br /> return false;<br /> }*/<br /> }<br />?><br />