本文整理汇总了PHP中db::insert_id方法的典型用法代码示例。如果您正苦于以下问题:PHP db::insert_id方法的具体用法?PHP db::insert_id怎么用?PHP db::insert_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类db
的用法示例。
在下文中一共展示了db::insert_id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: strtoupper
if (isset ( $_POST ['contato'] ))
$txtcontato = strtoupper ( $validations->validStringForm ( $_POST ['contato'] ) );
if (isset ( $_POST ['email'] ))
$txtemail = strtolower ( $validations->validStringForm ( $_POST ['email'] ) );
if (isset ( $_POST ['telefone'] ))
$txttelefone = $validations->validNumeric ( $_POST ['telefone'] );
if (isset ( $_POST ['fax'] ))
$txtfax = $validations->validNumeric ( $_POST ['fax'] );
if (isset ( $_POST ['idenest'] ))
$ie = $validations->validNumeric ( $_POST ['idenest'] );
if (isset ( $_POST ['cep'] ))
$txtcep = $validations->validNumeric ( $_POST ['cep'] );
if (isset ( $_POST ['bairro'] ))
$txtbairro = strtoupper ( $validations->validStringForm ( $_POST ['bairro'] ) );
if (isset ( $_POST ['pais'] ))
$pais = $validations->validNumeric ( $_POST ['pais'] );
$sql = "SELECT idfornecedor FROM fornecedor WHERE nome='" . $txtnome . "'";
$query = $db->query ( $sql );
if ($db->num_rows ( $query )) {
$row = $db->fetch_assoc ( $query );
$id = $row ['idfornecedor'] . '|1';
} else {
echo $sql = "INSERT INTO fornecedor ( nome, cnpj, uf, cidade, endereco, contato, email, telefone, fax, ie, cep, bairro, idpais ) VALUES ( '" . strtoupper ( $txtnome ) . "', '" . $cnpj . "', '" . $txtuf . "', '" . $txtcidade . "', '" . $txtendereco . "', '" . $txtcontato . "', '" . $txtemail . "', '" . $txttelefone . "', '" . $txtfax . "', '" . $ie . "', '" . $txtcep . "', '" . $txtbairro . "', '" . $pais . "' )";
$db->query ( $sql );
$id = $db->insert_id () . '|0';
}
echo $id;
?>
示例2: substr
$member['cookietime'] = $member['cktime'] ? $member['cktime'] - TIME : 0;
if ($action == 'login') {
$member['username'] = preg_replace("/(c:\\con\\con\$|[%,\\*\"\\s\t\\<\\>\\&])/i", "", $member['username']);
if (strlen($member['username']) > 20) {
$member['username'] = substr($member['username'], 0, 20);
}
if (empty($member['time']) || empty($member['username']) || empty($member['password'])) {
exit('Lack of required parameters!');
} elseif ($setting['passport_expire'] && TIME - $member['time'] > $setting['passport_expire']) {
exit('Request expired!');
}
$user = $db->fetch_first("SELECT * FROM " . DB_TABLEPRE . "user WHERE username='" . $member['username'] . "'");
if ($user) {
$uid = $user['uid'];
// $user->edit($member);
} else {
$credit1 = $setting['credit1_register'];
$credit2 = $setting['credit2_register'];
$db->query("INSERT INTO " . DB_TABLEPRE . "user(username,password,email,credit1,credit2) values ('{$member['username']}','{$member['password']}','{$member['email']}',{$credit1},{$credit2})");
$uid = $db->insert_id();
$db->query("INSERT INTO " . DB_TABLEPRE . "credit(uid,time,operation,credit1,credit2) VALUES ({$uid}," . TIME . ",'user/register',{$credit1},{$credit2}) ");
}
$forward = empty($forward) ? $setting['passport_server'] : $forward;
$auth = strcode("{$uid}\t" . $member['password'], $setting['auth_key'], 'ENCODE');
tcookie('auth', $auth, 24 * 3600 * 365);
} elseif ($action == 'logout' || $action == 'quit') {
tcookie('sid', '');
tcookie('auth', '');
$forward = empty($forward) ? $setting['passport_server'] : $forward;
}
header('location:' . $forward);
示例3: strtotime
if (! isset ( $_SESSION ['turno'] )) {
$turno = 0;
} else {
$turno = $_SESSION ['turno'];
}
$sync_timestamp = strtotime ( 'now' );
$estornado = 0;
$diaatual = date ( 'd' );
$sql = "INSERT INTO mv_vendas_vip ( controle, data_venda, id_cliente, cad_login_id, sync_timestamp ) VALUES ( " . $_SESSION ['controlevenda'] . ", '" . date ( 'Y-m-d' ) . "', " . $idcliente . ", " . $idlogin . ", '" . $sync_timestamp . "' )";
$query = $db->query ( $sql );
$venda_vip_id = $db->insert_id ();
$lista_carrinho = $_SESSION ['carrinho_venda'];
$num_lista = 0;
foreach ( $lista_carrinho ['produto_nome'] as $key => $value ) {
$sql = "SELECT vlcusto FROM produto WHERE idproduto=" . $key . "";
$query = $db->query ( $sql );
$row = $db->fetch_array ( $query );
if (isset ( $lista_carrinho ['grade_nome'] [$key] )) {
$quantidade = array_sum ( $lista_carrinho ['grade_qtd'] [$key] );
$grade = true;
} else {
$quantidade = $lista_carrinho ['produto_quantidadetotal'] [$key];
示例4: GoForum
//.........这里部分代码省略.........
}
$text_forum = preg_replace('#(\\A[\\s]*<br[^>]*>[\\s]*|' . '<br[^>]*>[\\s]*\\Z)#is', '', $text_forum);
$text_forum = stripslashes($text_forum);
$news_seiten = explode("{PAGEBREAK}", $text_forum);
if (count($news_seiten) > 1) {
$text_forum = $news_seiten[0];
$text_forum .= "<br/><a href=\"" . $this->_get_news_link($post, $category_id) . "\" >" . $this->lang['view_full'] . "</a>";
}
$text_forum = $this->_parseBB($text_forum, $post['id'], 'post');
if ($this->config['link_on_news'] && count($news_seiten) <= 1) {
$this->config['text_post_on_forum'] = preg_replace('/{post_name}/is', $post['title'], $this->config['text_post_on_forum']);
$this->config['text_post_on_forum'] = preg_replace('/{post_link}/is', $this->_get_news_link($post, $category_id), $this->config['text_post_on_forum']);
$text_forum .= "\n" . $this->config['text_post_on_forum'];
}
break;
case "short":
if (iconv_strlen($post['short_story'], DLE_CHARSET) < 10) {
$text_forum = $post['full_story'];
} else {
$text_forum = $post['short_story'];
}
$text_forum = preg_replace('#(\\A[\\s]*<br[^>]*>[\\s]*|' . '<br[^>]*>[\\s]*\\Z)#is', '', $text_forum);
$text_forum = stripslashes($text_forum);
$news_seiten = explode("{PAGEBREAK}", $text_forum);
if (count($news_seiten) > 1) {
$text_forum = $news_seiten[0];
$text_forum .= "<br/><a href=\"" . $this->_get_news_link($post, $category_id) . "\" >" . $this->lang['view_full'] . "</a>";
}
$text_forum = $this->_parseBB($text_forum, $post['id'], 'post');
if ($this->config['link_on_news'] && count($news_seiten) <= 1) {
$this->config['text_post_on_forum'] = preg_replace('/{post_name}/is', $post['title'], $this->config['text_post_on_forum']);
$this->config['text_post_on_forum'] = preg_replace('/{post_link}/is', $this->_get_news_link($post, $category_id), $this->config['text_post_on_forum']);
$text_forum .= "\n" . $this->config['text_post_on_forum'];
}
break;
case "old":
$text_forum = preg_replace('/{post_name}/i', $post['title'], $this->config['text_post_on_forum']);
$text_forum = preg_replace('/{post_link}/i', $this->_get_news_link($post, $category_id), $text_forum);
break;
default:
return false;
}
if (empty($text_forum)) {
die('Unknow post text');
}
$user_id = 0;
switch ($this->config['link_user']) {
case "author":
$author = $this->db->safesql($this->_convert_charset($post['autor']));
$user_info = $this->db->super_query("SELECT userid FROM " . VB_PREFIX . "user WHERE username='{$author}' LIMIT 1");
$user_id = $user_info['userid'];
$user = $this->_convert_charset($post['autor']);
break;
case "cur_user":
if ($GLOBALS['member_id']['name']) {
$user_name = $this->db->safesql($this->_convert_charset($GLOBALS['member_id']['name']));
$user_info = $this->db->super_query("SELECT userid FROM " . VB_PREFIX . "user WHERE username='{$user_name}' LIMIT 1");
$user = $this->_convert_charset($GLOBALS['member_id']['name']);
$user_id = $user_info['userid'];
break;
}
case "old":
$user_id = intval($this->config['postuserid']);
if ($user_id && ($user = $this->db->super_query("SELECT username FROM " . VB_PREFIX . "user WHERE userid=" . $user_id))) {
$user = $user['username'];
} else {
$user = $this->config['postusername'];
$user_id = 0;
}
break;
default:
break;
}
if (empty($user)) {
die('Unknow post user name');
}
$categories = explode(",", $post['category']);
foreach ($categories as $category) {
if (intval($this->config['vb_link_forumid'][$category])) {
$forum_id = $this->config['vb_link_forumid'][$category];
break;
}
}
if (!$forum_id || !$this->db->super_query("SELECT forumid FROM " . VB_PREFIX . "forum WHERE parentid!=-1 AND forumid=" . $forum_id)) {
die('Unknow forumid for current category');
}
$user = $this->db->safesql($user);
$text_forum = $this->db->safesql($this->_convert_charset($text_forum));
if ($user_id) {
$this->db->query('UPDATE ' . VB_PREFIX . "user SET posts=posts+1 WHERE userid={$user_id}");
}
$this->db->query("INSERT INTO " . VB_PREFIX . "thread (title, lastpost, forumid, open, postusername, postuserid, lastposter, dateline, visible) VALUES ('{$title_forum}', '" . TIMENOW . "', '{$forum_id}', '1', '{$user}', '{$user_id}', '{$user}', '" . TIMENOW . "', '1')");
$th_id = $this->db->insert_id();
$this->db->query("INSERT INTO " . VB_PREFIX . "post (threadid, username, userid, title, dateline, pagetext, allowsmilie, ipaddress, visible, showsignature) VALUES ('{$th_id}', '{$user}', '{$user_id}', '{$title_forum}', '" . TIMENOW . "', '{$text_forum}', '1', '" . $this->db->safesql(IPADRESS) . "', '1', 1)");
$post_id = $this->db->insert_id();
$this->db->query("UPDATE " . VB_PREFIX . "thread SET firstpostid='{$post_id}', lastpostid='{$post_id}' WHERE threadid='{$th_id}'");
$this->db->query("UPDATE " . VB_PREFIX . "forum SET lastpost='" . TIMENOW . "', lastposter='{$user}', lastpostid='{$post_id}', lastthread='{$title_forum}', lastthreadid='{$th_id}', threadcount=threadcount+1 WHERE forumid='{$forum_id}'");
header("Location:{$this->vb_config['bburl']}/showthread.php?t={$th_id}");
exit;
}
示例5: Insert
/**
* Insert new client to database
*/
public function Insert()
{
$this->db->query("INSERT INTO \n\t\t\t`" . TABLE_FROXLOR_CLIENTS . "` \n\t\tSET\n\t\t\t`name` = '" . $this->db->escape($this->Get('name')) . "', \n\t\t\t`desc` = '" . $this->db->escape($this->Get('desc')) . "', \n\t\t\t`enabled` = '" . (int) $this->Get('enabled') . "';\n\t\t");
$this->cid = $this->db->insert_id();
return $this->cid;
}
示例6: chr
$char = chr ( ord ( $char ) - ord ( $keychar ) );
$result .= $char;
}
return $result;
}
$id_desenvolvedor = 1;
$db = new db ( );
$db->connect ();
$timestamp = strtotime ( 'now' );
$sql = "INSERT INTO atualizacao (timestamp) VALUES (" . $timestamp . ")";
$db->query ( $sql );
$id_atualizacao = $db->insert_id ();
$arquivo = Array ();
$i = 0;
if ($handle = opendir ( $diretorio )) {
while ( false !== ($file = readdir ( $handle )) ) {
if ($file != "." && $file != "..") {
$file_ext = explode ( '.', $diretorio . '/' . $file );
if (! is_numeric ( $file_ext [1] ) || (isset ( $file_ext [2] ) && $file_ext [2] != 'rvs')) {
$nome_arquivo_simples = $file;
$file_ext = explode ( '.', $nome_arquivo_simples );
$nome_arquivo_novo_simples = $file_ext [0] . '.' . $timestamp . '.rvs';
$nome_arquivo = $diretorio . '/' . $nome_arquivo_simples;
示例7: validations
// //
////////////////////////////////////////////////////////////////////////////////////////
if (! isset ( $_CONF ['PATH'] )) {
require "../../config/default.php";
}
$validations = new validations ( );
$db = new db ( );
$db->connect ();
$login = strtoupper ( $validations->validStringForm ( $_POST ['login'] ) );
$sql = "SELECT id FROM cad_login WHERE login='" . $login . "'";
$query = $db->query ( $sql );
if (! $db->num_rows ( $query )) {
$nome = strtoupper ( $validations->validStringForm ( $_POST ['nome'] ) );
$senha = md5 ( $_POST ['senha'] );
$permissao = $validations->validNumeric ( $_POST ['permissao'] );
$sql = "INSERT INTO cad_login ( login, senha, autoriza, ativo, nome ) VALUES ( '" . $login . "', '" . $senha . "', " . $permissao . ", 'ativo', '" . $nome . "' )";
$db->query ( $sql );
echo $db->insert_id ();
} else {
echo '-';
}
?>
示例8: __autoload
<?php
function __autoload($classname)
{
if (is_readable($filename = $_SERVER['DOCUMENT_ROOT'] . "/inc/object/" . $classname . ".php")) {
} else {
if (is_readable($filename = $_SERVER['DOCUMENT_ROOT'] . "/inc/static/" . $classname . ".php")) {
} else {
if (is_readable($filename = $_SERVER['DOCUMENT_ROOT'] . "/inc/form/" . $classname . ".php")) {
} else {
echo '<pre><p>Class not found ' . $classname . '</p><p>' . print_r(debug_backtrace(), 1) . '</p></pre>';
}
}
}
include_once $filename;
}
\db::connect();
$res = \db::query('SELECT DISTINCT(mid) FROM glider');
$insert_statement = \db::prepare('INSERT INTO manufacturer SET title=:title');
$update_statement = \db::prepare('UPDATE glider SET manufacturer =:mid WHERE manufacturer = :title');
while ($row = \db::fetch($res)) {
$insert_statement->execute(array('title' => $row->manufacturer));
$id = \db::insert_id();
$update_statement->execute(array('title' => $row->manufacturer, 'mid' => $id));
}
示例9: doucenter
function doucenter()
{
$d_url = 'index.php?admin_setting-ucenter';
if (isset($this->post['submit'])) {
$settings['ucopen'] = $this->post['ucopen'];
$settings['feed'] = serialize($this->post['feed']);
$setting = $_ENV['setting']->update_setting($settings);
$this->cache->removecache('setting');
$this->message('UCenter设置成功!', $d_url);
} elseif (isset($this->post['ucsubmit'])) {
$ucopen = 1;
$ucapi = $this->post['ucapi'];
$ucpassword = $this->post['ucpassword'];
$ucip = $this->post['ucip'];
$ucapi = preg_replace("/\\/\$/", '', trim($ucapi));
$ucip = trim($ucip);
if (empty($ucapi) || !preg_match("/^(http:\\/\\/)/i", $ucapi)) {
$this->message('您输入的URL地址不正确!', $d_url);
}
if (!$ucip) {
$temp = @parse_url($ucapi);
$ucip = gethostbyname($temp['host']);
if (ip2long($ucip) == -1 || ip2long($ucip) === FALSE) {
$ucip = '';
}
}
define('UC_API', true);
if (!@(include_once HDWIKI_ROOT . '/api/uc_client/client.php')) {
$this->message('uc_client目录不存在。', $d_url);
}
$ucinfo = uc_fopen($ucapi . '/index.php?m=app&a=ucinfo&release=' . UC_CLIENT_RELEASE, 500, '', '', 1, $ucip);
list($status, $ucversion, $ucrelease, $uccharset, $ucdbcharset, $apptypes) = explode('|', $ucinfo);
if ($status != 'UC_STATUS_OK') {
$this->message('uc_url_unreachable', $d_url);
} else {
$dbcharset = strtolower(str_replace('-', '', trim(WIKI_CHARSET)));
$ucdbcharset = strtolower(str_replace('-', '', $ucdbcharset));
if (UC_CLIENT_VERSION > $ucversion) {
$this->message('uc_version_incorrect', $d_url);
} elseif ($dbcharset && $ucdbcharset != $dbcharset) {
$this->message('uc_dbcharset_incorrect', $d_url);
}
$tagtemplates = '';
$app_url = WIKI_URL;
$postdata = "m=app&a=add&ucfounder=&ucfounderpw=" . urlencode($ucpassword) . "&apptype=" . urlencode('OTHER') . "&appname=" . urlencode('HDWIKI') . "&appurl=" . urlencode($app_url) . "&appip=&appcharset=" . $dbcharset . '&appdbcharset=' . $dbcharset . '&' . $tagtemplates . '&release=' . UC_CLIENT_RELEASE;
$s = uc_fopen($ucapi . '/index.php', 500, $postdata, '', 1, $ucip);
if (empty($s)) {
$this->message('不能连接到 UCenter 服务端。', $d_url);
} elseif ($s == '-1') {
$this->message('UCenter 密码错误。', $d_url);
} else {
$ucs = explode('|', $s);
if (empty($ucs[0]) || empty($ucs[1])) {
$this->message('UCenter 不能返回数据。', $d_url);
}
}
$ucdata = "<?php\r\n\t\t\t\t\tdefine('UC_OPEN','{$ucopen}');\r\n\t\t\t\t\tdefine('UC_CONNECT', 'uc_api_post');\r\n\r\n\t\t\t\t\tdefine('UC_DBHOST', '{$ucs[2]}');\r\n\t\t\t\t\tdefine('UC_DBUSER', '{$ucs[4]}');\r\n\t\t\t\t\tdefine('UC_DBPW', '{$ucs[5]}');\r\n\t\t\t\t\tdefine('UC_DBNAME', '{$ucs[3]}');\r\n\t\t\t\t\tdefine('UC_DBCHARSET', '{$ucs[6]}');\r\n\t\t\t\t\tdefine('UC_DBTABLEPRE', '{$ucs[7]}');\r\n\r\n\t\t\t\t\tdefine('UC_KEY', '{$ucs[0]}');\r\n\t\t\t\t\tdefine('UC_API', '{$ucapi}');\r\n\t\t\t\t\tdefine('UC_CHARSET', '{$ucs[8]}');\r\n\t\t\t\t\tdefine('UC_IP', '{$ucip}');\r\n\t\t\t\t\tdefine('UC_APPID', '{$ucs[1]}');\r\n\t\t\t\t\t?>";
$byte = file::writetofile(HDWIKI_ROOT . '/api/ucconfig.inc.php', $ucdata);
if ($byte == 0) {
$this->message('不能写ucconfig.inc.php文件。', $d_url);
}
$this->message('UCenter 设置成功!', $d_url);
}
} elseif (isset($this->post['import'])) {
set_time_limit(0);
$url = HDWIKI_ROOT . '/api/ucconfig.inc.php';
if (!file_exists($url)) {
$this->message('您还没有设置过UCenter!', 'BACK');
} else {
include $url;
if (!(UC_OPEN && isset($this->setting['ucopen']) && $this->setting['ucopen'])) {
$this->message('您还没有开通ucenter!', 'BACK');
}
$url = HDWIKI_ROOT . "/data/import_uc.lock";
if (file_exists($url)) {
$this->message('您已经导入过用户,想重新导入请删除' . $url . '文件。', 'BACK');
}
}
#包含uc相应文件。
require_once HDWIKI_ROOT . '/api/uc_client/client.php';
require_once HDWIKI_ROOT . '/api/uc_client/lib/db.class.php';
#
#实例uc数据类
$ucdb = new db();
$ucdb->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, UC_DBCHARSET, UC_DBCONNECT, UC_DBTABLEPRE);
#
$this->load('user');
$ucuserlist = '';
$usercount = $_ENV['user']->get_total_num('', 0);
for ($i = 0; $i < $usercount; $i = $i + 100) {
$userlist = $_ENV['user']->get_list('', 0, $i, 100);
foreach ($userlist as $temUser) {
if (uc_get_user($temUser['username'])) {
$ucuserlist .= "username:" . $temUser['username'] . "\tuser_email:" . $temUser['email'] . "\r\n";
} else {
$salt = substr(uniqid(rand()), -6);
$password = md5($temUser['password'] . $salt);
$ucdb->query("INSERT INTO " . UC_DBTABLEPRE . "members SET username='" . $temUser['username'] . "', password='{$password}', email='" . $temUser['email'] . "', regip='" . $temUser['regip'] . "', regdate='" . time() . "', salt='" . $salt . "'");
$uid = $ucdb->insert_id();
$ucdb->query("INSERT INTO " . UC_DBTABLEPRE . "memberfields SET uid='{$uid}'");
//.........这里部分代码省略.........
示例10: strtolower
$cel2 = $validations->validNumeric ( $_POST ['cel2'] );
$cep = $validations->validNumeric ( $_POST ['cep'] . $_POST ['cepdv'] );
$email = strtolower ( $validations->validStringForm ( $_POST ['email'] ) );
$cpf = $validations->validStringForm ( $_POST ['cpf'] );
$cpf = str_replace ( '.', '', str_replace ( '-', '', $cpf ) );
$identidade = $validations->validStringForm ( $_POST ['identidade'] );
$infoadd = strtoupper ( $validations->validStringForm ( $_POST ['infoadd'] ) );
if ($_POST ['mes'] > 0) {
$dataniver = date ( 'Y' ) . '-' . $_POST ['mes'] . '-' . $_POST ['dia'];
} else {
$dataniver = '';
}
$telefone = str_pad ( str_replace ( '-', '', $dddtel . $tel1 . $tel2 ), 10, '0', STR_PAD_LEFT );
$celular = str_pad ( str_replace ( '-', '', $dddcel . $cel1 . $cel2 ), 10, '0', STR_PAD_LEFT );
$dtcadastro = date ( 'Y-m-d' );
$sql = "INSERT INTO cliente ( txtcep, txtnome, txtendereco, txtbairro, txtcidade, txtuf, txttelefone, txtcelular, txtemail, txtcpf, dtaniversario, txtrg, txtinf_adicional, dtcadastro) VALUES ( '" . $cep . "', '" . $nome . "', '" . $endereco . "', '" . $bairro . "', '" . $cidade . "', '" . $estado . "', '" . $dddtel . $tel1 . $tel2 . "', '" . $dddcel . $cel1 . $cel2 . "', '" . $email . "', '" . $cpf . "', '" . $dataniver . "', '" . $identidade . "', '" . nl2br ( $infoadd ) . "', '" . $dtcadastro . "') ";
if ($db->query ( $sql )) {
echo "CLIENTE ADICIONADO COM SUCESSO|" . $db->insert_id ();
} else {
echo "Ocorreu um erro, por favor tente novamente";
}
}
?>
示例11: VALUES
} else {
$vr_creditototal = 0;
}
$total_temp = ($vr_dinheiro+$vr_chequetotal+$vr_creditototal+$vr_debito+$vr_outro)-$vr_totalvenda;
//if ($total_temp>0){
$vr_dinheiro = $vr_dinheiro-$total_temp;
//}
$sql = "INSERT INTO mv_vendas ( controle, data_venda, id_cliente, id_login, vr_totalvenda, vr_opcionalvenda, parcelas, vr_dinheiro, vr_cheque, vr_cartao, vr_debito, vr_outro, terminal, turno, credit_id, debit_id, sync_timestamp ) VALUES ( " . $_SESSION ['controlevenda'] . ", '" . date ( 'Y-m-d' ) . "', " . $idcliente . ", " . $idlogin . ", '" . $vr_totalvenda . "', '" . $vr_opcionalvenda . "', " . $parcelas . ", '" . $vr_dinheiro . "', '" . $vr_chequetotal . "', '" . $vr_creditototal . "', '" . $vr_debito . "', '" . $vr_outro . "', '" . $terminal . "', '" . $turno . "', " . $credit_id . ", " . $debit_id . ", " . $sync_timestamp . " )";
$query = $db->query($sql);
$sql = "UPDATE mv_financeiro SET venda_id=".$db->insert_id()." WHERE controle=".$_SESSION ['controlevenda']."";
$query = $db->query ( $sql );
$lista_carrinho = $_SESSION['carrinho_venda'];
$num_lista = 0;
$totalitens = count($lista_carrinho ['produto_nome']);
foreach ( $lista_carrinho['produto_nome'] as $key => $value ) {
$sql = "SELECT vlcusto FROM produto WHERE idproduto=" . $key . "";
$query = $db->query ( $sql );
$row = $db->fetch_array ( $query );
$quantidade = $lista_carrinho['produto_quantidadetotal'][$key];
示例12: produto
$vltotal = ($_POST ['vltotal']) ? $validations->validStringForm ( $_POST ['vltotal'] ) : 0;
$dtnota = $validations->validNumeric ( $_POST ['anonota'] ) . '-' . $validations->validNumeric ( $_POST ['mesnota'] ) . '-' . $validations->validNumeric ( $_POST ['dianota'] );
if ($fornecedor == 0)
$fornecedor = $validations->validNumeric ( $_POST ['fornecedor'] );
if (isset ( $_SESSION ['gradeproduto'] ))
$grade = 1;
else
$grade = 0;
$sql = "INSERT INTO produto ( cod_interno, txtproduto, vlcusto, vlprontaentrega, vlatacado, vlvarejo, qtdestoque, produtotipo_idprodutotipo, fornecedor_idfornecedor, colecao_idcolecao, cod_barra, dtcadastro, grade, stcontroleestoque, sync_timestamp ) VALUES ( '" . $codigo . "', '" . $nome . "', '" . $vlcusto . "', '" . $vlpentrega . "', '" . $vlatacado . "', '" . $vlvarejo . "', " . $qtdestoque . ", " . $categoria . ", " . $fornecedor . ", " . $colecao . ", " . $codbarra . ", '" . strtotime ( 'now' ) . "', " . $grade . ", 1, " . strtotime ( 'now' ) . " )";
if ($db->query ( $sql )) {
$idproduto = $db->insert_id ();
if ($grade == 1) {
$arraygrade = '';
$total = count ( $_SESSION ['gradeproduto'], COUNT_RECURSIVE ) / 3;
for($i = 1; $i < $total; $i ++) {
$descricao_grade = strtoupper ( $validations->validStringForm ( $_SESSION ['gradeproduto'] ['descricao'] [$i] ) );
$quantidade_grade = $validations->validNumeric ( $_SESSION ['gradeproduto'] ['quantidade'] [$i] );
$vlprodgrade_grade = $validations->validStringForm ( $_SESSION ['gradeproduto'] ['vlprodgrade'] [$i] );
$sql = "INSERT INTO cad_produtos_grade ( id_produto, descricao, quantidade, vlprodgrade ) VALUES ( " . $idproduto . ", '" . $descricao_grade . "', '" . $quantidade_grade . "', '" . $vlprodgrade_grade . "' )";
$db->query ( $sql );
$arraygrade .= '#|#' . $descricao_grade . '+-+' . $quantidade_grade . '+-+' . $vlprodgrade_grade;
}
示例13: show
public function show()
{
$progressPath = CACHE_DIR . 'progress.txt';
$totalPath = CACHE_DIR . 'total.txt';
$is_next = true;
if (file_exists($progressPath) && file_exists($totalPath)) {
$progress = file_get_contents($progressPath);
$total = file_get_contents($totalPath);
} else {
file_put_contents($progressPath, 0);
$sql = 'SELECT max(member_id) as max,min(member_id) as min FROM ' . DB_PREFIX . 'member';
$max_min = $this->db->query_first($sql);
file_put_contents($totalPath, $max_min['max']);
file_put_contents($progressPath, $max_min['min']);
$progress = $max_min['min'] - 1;
$total = $max_min['max'];
}
$newlegth = intval($progress + LENGTH);
if ($newlegth > intval($total)) {
$newlegth = $total;
$is_next = false;
}
$sql = 'SELECT * FROM ' . DB_PREFIX . 'member where ( member_id >' . $progress . ') AND ( member_id <= ' . $newlegth . ') order by member_id asc ';
$query = $this->db->query($sql);
$member = array();
$member_id = array();
while ($row = $this->db->fetch_array($query)) {
$member[$row['member_id']] = $row;
$member_id[] = $row['member_id'];
}
if ($member_id) {
$sql = 'SELECT * FROM ' . DB_PREFIX . 'member_bind where member_id IN (' . implode(',', $member_id) . ') order by member_id asc ';
$query = $this->db->query($sql);
$member_bind = array();
while ($row = $this->db->fetch_array($query)) {
$member_bind[$row['member_id']][] = $row;
}
}
if (!empty($member)) {
$source_db = array('host' => 'localhost', 'user' => 'root', 'pass' => 'hogesoft', 'database' => 'jn_members2', 'charset' => 'utf8', 'pconncet' => '0', 'dbprefix' => 'm2o_');
$_sourceDB = new db();
$_sourceDB->connect($source_db['host'], $source_db['user'], $source_db['pass'], $source_db['database'], $source_db['charset'], $source_db['pconnect'], $source_db['dbprefix']);
foreach ($member as $key => $val) {
$insertData = $val;
if (!$val['guid']) {
$insertData['guid'] = guid();
}
$sql = 'SELECT count(*) as total FROM ' . DB_PREFIX . 'member where member_name = \'' . $insertData['member_name'] . '\' AND type = \'' . $insertData['type'] . '\'';
$isInsert = $_sourceDB->query_first($sql);
if ($isInsert['total'] > 0) {
file_put_contents(CACHE_DIR . 'error_member.txt', var_export($insertData, 1), FILE_APPEND);
continue;
}
unset($insertData['member_id']);
$cmd = $replace ? 'REPLACE INTO ' : 'INSERT INTO ';
$sql = $cmd . DB_PREFIX . 'member SET ' . $this->setField($insertData);
$_sourceDB->query($sql);
$iid = $_sourceDB->insert_id();
if (!$iid) {
break;
}
$sql = 'INSERT INTO ' . DB_PREFIX . 'member_count (
u_id
)
VALUES(
' . $iid . '
)';
$_sourceDB->query($sql);
if ($_member_bind = $member_bind[$val['member_id']]) {
foreach ($_member_bind as $k => $v) {
$inuc = 0;
$v['member_id'] = $iid;
if ($v['type'] == 'm2o' && $v['inuc'] == 0) {
$v['platform_id'] = $iid;
}
if ($v['type'] == 'uc') {
$inuc = $v['platform_id'];
} else {
if ($v['inuc'] != 0) {
$inuc = $v['inuc'];
}
}
$sql = 'SELECT count(*) as total FROM ' . DB_PREFIX . 'member_bind where member_id = ' . $v['member_id'] . ' AND platform_id = \'' . $v['platform_id'] . '\' AND type = \'' . $v['type'] . '\'';
$isInsertBind = $_sourceDB->query_first($sql);
if ($isInsertBind['total'] > 0) {
file_put_contents(CACHE_DIR . 'error_memberbind.txt', var_export($v, 1), FILE_APPEND);
continue;
}
$cmd = $replace ? 'REPLACE INTO ' : 'INSERT INTO ';
$sql = $cmd . DB_PREFIX . 'member_bind SET ' . $this->setField($v);
$_sourceDB->query($sql);
if ($inuc) {
$sql = 'UPDATE ' . DB_PREFIX . 'member_bind SET inuc =\'' . $inuc . '\' WHERE member_id = ' . $iid;
$_sourceDB->query($sql);
}
}
}
}
$_sourceDB->close();
file_put_contents($progressPath, $newlegth);
//.........这里部分代码省略.........
示例14: array
$item_img = $find_list_img[$j]->src;
}
$version = $itemhtml->find('div[class=meta-info] div[itemprop="softwareVersion"]')[0]->plaintext;
$manufacture = $itemhtml->find('a[class="document-subtitle primary"] span')[0]->plaintext;
$post_meta['_infomation_name'] = $title;
$post_meta['_infomation_version'] = $version;
$post_meta['_infomation_manufacturers'] = $manufacture;
$post_meta['snap_isAutoPosted'] = 1;
$post_meta['_internal_link_exist'] = "yes";
// Lay thong tin bai viet
$content_ = $itemhtml->find("div[class=show-more-content]");
$content .= $content_[0]->innertext;
if ($images != "") {
$post = array('post_title' => $title, 'post_content' => $content, 'post_status' => 'publish', 'post_author' => 1, 'post_date' => date("Y-m-d H:i:s"), 'post_date_gmt' => date("Y-m-d H:i:s"), 'post_name' => vnit_change_title($title), 'post_modified' => date("Y-m-d H:i:s"), 'post_modified_gmt' => date("Y-m-d H:i:s"), 'id_com' => $id_com, 'guid' => 'http://masterapk.com/dungml/' . vnit_change_title($title) . '/');
$db->insert("wp_posts", $post);
$post_id = $db->insert_id();
// Tang so luong category
$db->query("UPDATE wp_term_taxonomy SET count = count + 1 WHERE term_id = " . $row->term_id);
// Insert wp_term
$term['name'] = $title;
$term['slug'] = vnit_change_title($title);
$db->insert("wp_terms", $term);
$term_id = $db->insert_id();
// insert wp_term_taxonomy
$term_taxo['term_id'] = $term_id;
$term_taxo['taxonomy'] = 'post_tag';
$term_taxo['count'] = '0';
$db->insert("wp_term_taxonomy", $term_taxo);
$term_taxonomy_id = $db->insert_id();
//insert wp_term_relationships
$term_re['object_id'] = $post_id;
示例15: validations
$validations = new validations ( );
$db = new db ( );
$db->connect ();
if ($_REQUEST ['fluxo'] == 'receita') {
$tipo_lancamento = "E";
} elseif ($_REQUEST ['fluxo'] == 'despesa') {
$tipo_lancamento = "S";
}
$novo_favorecido = utf8_decode ( $_REQUEST ['novo_favorecido'] );
$sql = "INSERT INTO fornecedor (
nome ,
tipo_lancamento
)
VALUES (
'{$novo_favorecido}', '{$tipo_lancamento}'
);";
$db->query ( $sql );
$new_id = $db->insert_id ();
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
echo "<plano>\n";
echo "<id>" . $new_id . "</id>\n";
echo "<nome>" . $novo_favorecido . "</nome>\n";
echo "</plano>\n";
?>