Skip to content

Instantly share code, notes, and snippets.

@imvkmark
Last active December 15, 2015 15:09
Show Gist options
  • Save imvkmark/5280120 to your computer and use it in GitHub Desktop.
Save imvkmark/5280120 to your computer and use it in GitHub Desktop.
mysql:creat insert sql
function createInsertSql(){
$fields = array('tuanno','adddate','tuanname','tuanbianhao','buydate','dipeiname','guideno','guidemobile','contacttel','contactfax','tuantype','area','traffic','sleepis','sleephotel','tuannum','buynum','tickect','allnum');
$sqlk = $sqlv = '';
foreach($info as $k=>$v) {
if(in_array($k, $fields)) { $sqlk .= ','.$k; $sqlv .= ",'$v'"; }
}
$sqlk = substr($sqlk, 1);
$sqlv = substr($sqlv, 1);
$db->query("INSERT INTO mg_form_team ($sqlk) VALUES ($sqlv)");
if ($db->insert_id()) {
showmessage('申报完成,请等待审核!', WLSL_PATH.'member/');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment