本文整理汇总了PHP中array2sql函数的典型用法代码示例。如果您正苦于以下问题:PHP array2sql函数的具体用法?PHP array2sql怎么用?PHP array2sql使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了array2sql函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: orderLog
public static function orderLog($orderid, $ss, $note, $orderType = "")
{
!self::$dbConn ? self::initDB() : null;
$where = "where id={$orderid}";
$orderinfo = OmAvailableModel::getTNameList("om_unshipped_order", "*", $where);
$sql = array();
$sql['operatorId'] = $_SESSION['sysUserId'];
$sql['omOrderId'] = $orderid;
//$sql['note'] = "编辑订单";
$sql['note'] = $note;
$sql['sql'] = mysql_real_escape_string($ss);
$sql['createdTime'] = time();
if (!empty($orderType) && $orderinfo[0]['orderType'] != $orderType) {
$sql['oldStatus'] = $orderinfo[0]['orderType'];
$sql['newStatus'] = $orderType;
$sql['note'] .= "修改订单状态";
}
$strmctime = date('Y_m', time());
$sql = "INSERT INTO om_order_log_" . $strmctime . " set " . array2sql($sql);
$sql = self::$dbConn->query($sql);
if ($sql) {
return true;
} else {
return false;
//echo $sql;
}
}
示例2: insertOrderDeclarationContent
/**
* 插入订单快递描述的方法,key为fedexRemark,现在只有独立商城会用到
* 以下为demo
* @param array $data 为一个二维数组,至少是一条快递描述记录
* @return bool
* @author zqt
* @modify 20140807 修改方法名,同时订单大数组键改为了declarationContent,表也换了
*/
public function insertOrderDeclarationContent($data)
{
$data = array_filter($data);
if (empty($data)) {
//如果$data为空,则不支持操作,直接返回,因为订单跟踪号是非必须的
return true;
}
//检测订单号是否插入成功
if ($this->_orderid == 0) {
return false;
} else {
foreach ($data as $key => $value) {
$data[$key]['omOrderId'] = $this->_orderid;
$data[$key]['datetime'] = time();
}
}
$table = C('DB_PREFIX') . 'declaration_content';
foreach ($data as $value) {
$fdata = $this->formatInsertField($table, $value);
if ($fdata === false) {
self::$errMsg = $this->validatemsg;
return false;
}
if (!$this->sql("INSERT INTO {$table} SET " . array2sql($fdata))->insert()) {
return false;
}
}
return true;
}
示例3: updateStatInfo
/**
* WebAdStatModel::updateStatInfo()
* 更新广告访问统计信息
* @param int $ipNum ip数值
* @param int $ids 广告ID
* @param array $data 数据集
* @return array 结果集数组
*/
public static function updateStatInfo($ipNum, $ids, $data)
{
self::initDB();
$res = self::showIpAdStat($ipNum, $ids);
$sql = array2sql($data);
if ($res) {
$id = $res['id'];
$sql = "UPDATE `" . self::$prefix . self::$table . "` SET " . $sql . " WHERE id = '{$id}'";
} else {
$sql = "INSERT INTO `" . self::$prefix . self::$table . "` SET " . $sql;
}
$query = self::$dbConn->query($sql);
if ($query) {
$rows = self::$dbConn->affected_rows();
if ($rows) {
return $rows;
} else {
self::$errCode = 10001;
self::$errMsg = "更新数据失败";
return false;
}
} else {
self::$errCode = 10000;
self::$errMsg = "执行SQL语句出错";
return false;
}
}
示例4: insert_data
/**
* WhOrderPartionPrintDHLModel::insert_data()
* 插入新加坡口袋信息
* @param mixed $data
* @return void
*/
public static function insert_data($data)
{
self::initDB();
$sql = 'insert into ' . self::$tablename . ' set ' . array2sql($data);
$sql = self::$dbConn->query($sql);
return self::$dbConn->insert_id();
}
示例5: update_wave_info
/**
* WhWaveInfoModel::update_wave_info()
* 更新配货单信息
* @param array $update 更新字段内容
* @param array $where 条件内容
* @return void
*/
public static function update_wave_info($update, $where)
{
self::initDB();
$sql = 'update ' . self::$tablename . ' set ' . array2sql($update) . ' where ' . array2where($where);
//echo $sql;
$sql = self::$dbConn->query($sql);
return $sql;
}
示例6: updateOrderRecord
public static function updateOrderRecord($where, $update)
{
self::initDB();
$sql = 'update wh_orderb_history set ' . array2sql($update) . ' where ' . array2where($where);
//echo $sql;exit;
$sql = self::$dbConn->query($sql);
return $sql;
}
示例7: updateUserCompetence
public static function updateUserCompetence($nameList, $smsnum)
{
self::initDB();
$successnum = 0;
$success = array();
$error = array();
//设置批量修改记录标志变量
foreach ($nameList as $from) {
$table = "`power_global_user`";
//获取用户的global_user_id
$filed = "global_user_id";
$where = " global_user_status = 1 AND global_user_is_delete = 0 AND (global_user_login_name = '{$from}' OR global_user_name = '{$from}') LIMIT 1 ";
$ret = self::selectOneTable($table, $filed, $where);
if (!$ret[0]['global_user_id']) {
self::$errCode = "1057";
self::$errMsg = "获取用户资料失败";
return false;
}
$from = $ret[0]['global_user_id'];
$username = $ret[0]['global_user_name'];
$field = "num";
$sql = "SELECT {$field} FROM `" . C('PREFIX') . self::$tabsmspower . "` WHERE 1 AND `global_user_id` = '{$from}' AND `is_delete` = 0 LIMIT 1 ";
$query = self::$dbConn->query($sql);
$sumnum = self::$dbConn->fetch_array_all($query);
//查询在nt_sms_power中是否有sms_num记录
if ($sumnum) {
//存在记录则更新
$field = "num";
$sql = "UPDATE " . C('PREFIX') . self::$tabsmspower . " SET num = '{$smsnum}' WHERE global_user_id = '{$from}'";
$query = self::$dbConn->query($sql);
if ($query) {
$affectedrows = self::$dbConn->affected_rows();
$successnum++;
array_push($success, $username);
} else {
array_push($error, $username);
}
} else {
//不存在记录则插入
$data = array("global_user_id" => $from, "num" => $smsnum, "is_delete" => "0");
$def = array2sql($data);
//将数组转为SET后面的sql语句
$def = "INSERT INTO `" . C('PREFIX') . self::$tabsmspower . "` SET " . $def;
$query = self::$dbConn->query($def);
if ($query) {
$successnum++;
array_push($success, $username);
} else {
array_push($error, $username);
}
}
}
if ($successnum === count($nameList)) {
return array("ret" => "ok", "success" => $success);
} else {
return array("ret" => "no", "errorUser" => $error, "success" => $success);
}
}
示例8: updateByAccountId
/**
* 修改指定表信息在unshiped表中,按照accountId条件
* @param int $id 订单号
* @param array $userInfoArr 用户信息数组
* @return bool
* @author zqt
*/
public function updateByAccountId($table, $accountId, $data)
{
$fdata = $this->formatUpdateField($table, $data);
if ($fdata === false) {
self::$errMsg = $this->validatemsg;
return false;
}
$accountId = intval($accountId);
//echo "UPDATE ".$table." SET ".array2sql($data)." WHERE accountId=$accountId AND is_delete=0";exit;
return $this->sql("UPDATE " . $table . " SET " . array2sql($data) . " WHERE accountId={$accountId} AND is_delete=0")->update();
}
示例9: updateWaveBoxColor
/**
* 更新箱子颜色表一条或多条记录,暂只支持一维数组
* @param array $data
* @param string $where
* @return boolean
* @author czq
*/
public static function updateWaveBoxColor($data, $where = "")
{
self::initDB();
$sql = "UPDATE " . self::$tablename . " SET " . array2sql($data) . " WHERE 1 " . $where;
$query = self::$dbConn->query($sql);
if ($query) {
return true;
} else {
return false;
}
}
示例10: updateMateria
function updateMateria($data)
{
global $dbConn;
$setContent = array2sql($data);
$sql = "update ebay_materia_statistics set {$setContent} where sku='{$data['sku']}'";
if ($dbConn->execute($sql)) {
return 1;
} else {
return 0;
}
}
示例11: addSuperAmountSku
/**
* 写入LOG日志
* @param $sql //修改订单的SQL语句
* @param $note //修改订单的操作
* @param $omOrderId //订单ID
* @return bool
*/
function addSuperAmountSku($data)
{
$table = C('DB_PREFIX') . 'records_order_audit';
$fdata = $this->formatInsertField($table, $data);
if ($fdata === false) {
self::$errMsg = $this->validatemsg;
var_dump(self::$errMsg);
exit;
return false;
}
$this->sql("INSERT " . $table . " SET " . array2sql($fdata))->insert();
}
示例12: insertRecord
public static function insertRecord($insertArr)
{
self::initDB();
//$sql = "INSERT INTO wh_tallying_list(batchNum,sku,num,tallyUserId,entryUserId,entryTime,purchaseId,storeId,entryStatus) VALUES('{$batchNum}','{$sku}',{$amount},{$checkUserId},{$userNameId},".time().",{$purchaseId},1,{$entryStatus})";
$sql = "INSERT INTO wh_tallying_list set " . array2sql($insertArr);
//echo $sql;
$query = self::$dbConn->query($sql);
if ($query) {
return true;
} else {
return false;
}
}
示例13: insertWaveConfigRow
/**
* 波次配置表插入一条记录
* @param array $data
* @return number $insertId
* @author czq
*/
public static function insertWaveConfigRow($data)
{
self::initDB();
$sql = "INSERT INTO " . self::$tablename . " SET " . array2sql($data);
$query = self::$dbConn->query($sql);
if ($query) {
$insertId = self::$dbConn->insert_id();
return $insertId;
} else {
self::$errCode = "003";
self::$errMsg = "error";
return false;
}
}
示例14: insertRow
/**
* 插入一条记录
* @para $data as array
* return insert_id
*/
public static function insertRow($data)
{
self::initDB();
$sql = array2sql($data);
$sql = "INSERT INTO `" . self::$table . "` SET " . $sql;
$query = self::$dbConn->query($sql);
if ($query) {
return true;
} else {
self::$errCode = "003";
self::$errMsg = "error";
return false;
}
}
示例15: modifyDistributorBasicInformation
/**
* 根据平台Id和accountid获取账号信息 分页显示
* @param array $data
* @return array
* @author yxd
*/
public function modifyDistributorBasicInformation($data)
{
$table = C('DB_PREFIX') . 'developer';
$fdata = $this->formatInsertField($table, $data);
if ($fdata === false) {
$this::$errMsg = $this->validatemsg;
return false;
}
$result = $this->sql("INSERT INTO {$table} SET " . array2sql($fdata))->insert();
if ($result) {
$this->_orderid = $this->getLastInsertId();
}
return $result;
}