本文整理汇总了PHP中Sql::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP Sql::insert方法的具体用法?PHP Sql::insert怎么用?PHP Sql::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sql
的用法示例。
在下文中一共展示了Sql::insert方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* Save Tag
* @return bollean
*/
public function save()
{
$data = array(self::ID_TAG => $this->getIdTag(), self::TAG => $this->getTag());
$sql = new Sql();
if (is_null($this->getIdTag())) {
$sql->insert($data, self::TABLE);
$this->idTag = $sql->lastRow(self::TABLE)->id_tag;
return true;
} else {
$pk = array(self::ID_TAG => $this->getIdTag());
return $sql->update($data, self::TABLE, $pk);
}
}
示例2: send
static function send($pj, $msg)
{
$pj = Characters::get($pj);
if (!$pj['success']) {
return array('success' => false, 'msg' => $pj['msg']);
} else {
$pj = $pj['data'];
}
PDOSql::$pdobj = pdoConnect();
$iduser = Sql::esc($pj['iduser']);
$msg = Sql::esc(str_replace('{%NAME%}', $pj['name'], $msg));
return Sql::insert("INSERT INTO notifications (iduser, msg, status) VALUES ('{$iduser}', '{$msg}', '0')");
}
示例3: save
/**
* Save
* @return bollean
*/
public function save()
{
$data = array(self::ISOLANG => $this->getIsoLang(), self::DEFAULT_CULTURE => $this->getDefault());
$sql = new Sql();
if (!self::hasCulture($this->getIsoLang())) {
$sql->insert($data, self::TABLE);
$this->isolang = $sql->lastRow(self::TABLE)->isolang;
return true;
} else {
$pk = array(self::ISOLANG => $this->getIsoLang());
return $sql->update($data, self::TABLE, $pk);
}
}
示例4: save
/**
* Save Log
* @return bollean
*/
public function save()
{
$data = array(self::ID => self::getId(), self::DATE => self::getDate(), self::FILE => self::getFile(), self::MESSAGE => self::getMessage(), self::IS_ERROR => self::getIsError());
$sql = new Sql();
if (is_null($this->getId())) {
$sql->insert($data, self::TABLE);
$this->id = $sql->lastRow(self::TABLE)->id;
return true;
} else {
$pk = array(self::ID => self::getId());
return $sql->update($data, self::TABLE, $pk);
}
}
示例5: insert
static function insert($table, $data, $connection = 'default')
{
return static::query(\Sql::insert($table, $data) . ' asd', $connection);
}
示例6: action_register
function action_register($login, $password, $repassword, $mail)
{
if ($password != $repassword) {
$d = array('success' => false, 'error' => 'password and repassword');
} else {
if (Sql::count('users', 'pseudo = ?', $login) > 0) {
$d = array('success' => false, 'error' => 'login');
} else {
if (!filter_var($mail, FILTER_VALIDATE_EMAIL)) {
$d = array('success' => false, 'error' => 'incorrect mail');
} else {
$data = array('pseudo' => $login, 'password' => $password, 'mail' => $mail);
Sql::insert('users', $data);
$d = array('success' => true);
}
}
}
return json_encode($d);
}
示例7: altaCategoria
static function altaCategoria($data)
{
if (!self::tieneCatCustom($_SESSION['clientID'])) {
self::createCatTbl($_SESSION['clientID']);
}
$tbl_name = "custom_cats_" . $_SESSION['clientID'];
PDOSql::$pdobj = pdoConnect();
$categoria = Sql::esc($data['categoria']);
$subcat = Sql::esc($data['subcategoria']);
$i = Sql::insert("INSERT INTO {$tbl_name} (categoria, subcategoria) values ('" . $categoria . "', '" . $subcat . "')");
if ($i > 0) {
return array('success' => true, 'data' => array(), 'msg' => 'Se creó la categoría personalizada');
}
}
示例8: save
/**
* Save Tag
* @return bollean
*/
public function save()
{
$data = array(self::ID_TAG_I18N => $this->getIdTagI18n(), self::ID_TAG => $this->getIdTag(), self::ISOLANG => $this->getIsoLang(), self::TRANSLATE => $this->getTranslate());
$sql = new Sql();
if (is_null($this->getIdTagI18n())) {
$sql->insert($data, self::TABLE);
$this->idTagI18n = $sql->lastRow(self::TABLE) ? $sql->lastRow(self::TABLE)->id_tag_i18n : '';
$this->idTag = $sql->lastRow(self::TABLE) ? $sql->lastRow(self::TABLE)->id_tag : '';
return true;
} else {
$pk = array(self::ID_TAG_I18N => $this->getIdTagI18n());
return $sql->update($data, self::TABLE, $pk);
}
}