本文整理汇总了PHP中sql::affected方法的典型用法代码示例。如果您正苦于以下问题:PHP sql::affected方法的具体用法?PHP sql::affected怎么用?PHP sql::affected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sql
的用法示例。
在下文中一共展示了sql::affected方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete($delete)
{
$affected = 0;
$sql = "DELETE FROM orders WHERE id='{$delete}'";
sql::query($sql);
$affected += sql::affected();
// удаление связей
$sql = "DELETE FROM files WHERE `table`='orders' AND rec_id='{$delete}'";
sql::query($sql);
$affected += sql::affected();
$sql = "SELECT * FROM tz WHERE order_id='{$delete}'";
$res = sql::fetchAll($sql);
foreach ($res as $rs) {
// удаление
$delete = $rs["id"];
$sql = "DELETE FROM tz WHERE id='{$delete}'";
sql::query($sql);
$affected += sql::affected();
// удаление связей
$sql = "SELECT * FROM posintz WHERE tz_id='{$delete}'";
$res1 = sql::fetchAll($sql);
foreach ($res1 as $rs1) {
$delete = $rs1["id"];
$sql = "DELETE FROM posintz WHERE id='{$delete}'";
sql::query($sql);
$affected += sql::affected();
}
}
return $affected;
}
示例2: setRecord
public function setRecord($data)
{
extract($data);
if ($action == "users") {
if (!empty($edit)) {
// редактирование
$sql = "UPDATE users\n SET nik='{$nik}',\n fullname='{$fullname}',\n position='{$position}',\n password='{$password1}'\n WHERE id='{$edit}'";
} else {
// добавление
$sql = "INSERT INTO users (nik,fullname,position,password)\n VALUES ('{$nik}','{$fullname}','{$position}','{$password1}')";
}
sql::query($sql);
} else {
$sql = "DELETE FROM rights WHERE u_id='{$userid}'";
sql::query($sql);
if (!empty($r)) {
foreach ($r as $key => $val) {
foreach ($val as $k => $V) {
$sql = "INSERT INTO rights (u_id,type_id,rtype_id,rights.right) VALUES ('{$userid}','{$key}','{$k}','1')";
sql::query($sql);
}
}
}
// почистить сессию для того чтоб вступили права пользователь должен перезайти
//$sql = "DELETE FROM session WHERE u_id='{$userid}'";
//sql::query($sql);
}
return sql::affected();
}
示例3: delete
public function delete($delete)
{
$affected = 0;
$sql = "INSERT INTO {$this->db}sk_arc_{$this->sklad}_spr (nazv,edizm,krost)\n SELECT sk_{$this->sklad}_spr.nazv,sk_{$this->sklad}_spr.edizm,sk_{$this->sklad}_spr.krost\n FROM {$this->db}sk_{$this->sklad}_spr\n WHERE sk_{$this->sklad}_spr.id='{$delete}'";
sql::query($sql);
$affected += sql::affected();
$id = sql::lastId();
$sql = "DELETE FROM {$this->db}sk_{$this->sklad}_spr WHERE id='{$delete}'";
sql::query($sql);
$affected += sql::affected();
$sql = "INSERT INTO {$this->db}sk_arc_{$this->sklad}_ost (spr_id,ost)\n SELECT {$id},sk_{$this->sklad}_ost.ost\n FROM {$this->db}sk_{$this->sklad}_ost\n WHERE sk_{$this->sklad}_ost.spr_id='{$delete}'";
sql::query($sql);
$affected += sql::affected();
$sql = "DELETE FROM {$this->db}sk_{$this->sklad}_ost WHERE spr_id='{$delete}'";
sql::query($sql);
$affected += sql::affected();
$sql = "INSERT INTO {$this->db}sk_arc_{$this->sklad}_dvizh (type,numd,numdf,docyr,spr_id,quant,ddate,post_id,comment_id,price)\n SELECT sk_{$this->sklad}_dvizh.type,sk_{$this->sklad}_dvizh.numd,sk_{$this->sklad}_dvizh.numdf,sk_{$this->sklad}_dvizh.docyr,{$id},sk_{$this->sklad}_dvizh.quant,sk_{$this->sklad}_dvizh.ddate,sk_{$this->sklad}_dvizh.post_id,sk_{$this->sklad}_dvizh.comment_id,sk_{$this->sklad}_dvizh.price\n FROM {$this->db}sk_{$this->sklad}_dvizh\n WHERE sk_{$this->sklad}_dvizh.spr_id='{$delete}'";
sql::query($sql);
$affected += sql::affected();
$sql = "DELETE FROM {$this->db}sk_{$this->sklad}_dvizh WHERE spr_id='{$delete}'";
sql::query($sql);
$affected += sql::affected();
$sql = "INSERT INTO {$this->db}sk_arc_{$this->sklad}_dvizh (type,numd,numdf,docyr,spr_id,quant,ddate,post_id,comment_id,price)\n SELECT sk_{$this->sklad}_dvizh_arc.type,sk_{$this->sklad}_dvizh_arc.numd,sk_{$this->sklad}_dvizh_arc.numdf,sk_{$this->sklad}_dvizh_arc.docyr,{$id},sk_{$this->sklad}_dvizh_arc.quant,sk_{$this->sklad}_dvizh_arc.ddate,sk_{$this->sklad}_dvizh_arc.post_id,sk_{$this->sklad}_dvizh_arc.comment_id,sk_{$this->sklad}_dvizh_arc.price\n FROM {$this->db}sk_{$this->sklad}_dvizh_arc\n WHERE sk_{$this->sklad}_dvizh_arc.spr_id='{$delete}'";
sql::query($sql);
$affected += sql::affected();
$sql = "DELETE FROM {$this->db}sk_{$this->sklad}_dvizh_arc WHERE spr_id='{$delete}'";
sql::query($sql);
$affected += sql::affected();
return $affected;
}
示例4: delete
public function delete($delete)
{
$affected = 0;
$sql = "DELETE FROM posintz WHERE id='{$delete}'";
sql::query($sql);
$affected += sql::affected();
return $affected;
}
示例5: delete
public function delete($delete)
{
$sql = "DELETE FROM blocks WHERE id='{$delete}'";
sql::query($sql);
$sql = "DELETE FROM blockpos WHERE block_id='{$delete}'";
sql::query($sql);
return sql::affected();
}
示例6: setRecord
public function setRecord($data)
{
extract($data);
if (!empty($edit)) {
$sql = "UPDATE todo SET what='" . addslashes($what) . "', cts=NOW(), rts='0', u_id='" . Auth::getInstance()->getUser('userid') . "' WHERE id='{$edit}'";
} else {
$sql = "INSERT INTO todo (what,cts,rts,u_id) VALUES ('" . addslashes($what) . "',NOW(),'0'," . Auth::getInstance()->getUser('userid') . ")";
}
sql::query($sql);
return sql::affected();
}
示例7: setRecord
public function setRecord($data)
{
extract($data);
if (!empty($edit)) {
$sql = "UPDATE rtypes SET type='{$type}' WHERE id='{$edit}'";
} else {
$sql = "INSERT INTO `rtypes` (`type`) VALUES ('{$type}')";
}
sql::query($sql);
return sql::affected();
}
示例8: setRecord
public function setRecord($data)
{
extract($data);
if (!empty($edit)) {
$sql = "UPDATE conductors SET pib='{$pib}', side='{$side}', lays='{$lays}', user_id='" . Auth::getInstance()->getUser('userid') . "', ts=NOW() WHERE id='{$edit}'";
} else {
$sql = "INSERT INTO conductors (board_id,pib,side,lays,user_id,ts) VALUES('{$board_id}','{$pib}','{$side}','{$lays}','" . Auth::getInstance()->getUser('userid') . "',NOW())";
}
sql::query($sql);
return sql::affected();
}
示例9: delete
public function delete($delete)
{
$affected = 0;
$sql = "SELECT * FROM {$this->db}sk_{$this->sklad}_dvizh\n WHERE id='{$delete}'";
$rs = sql::fetchOne($sql);
$sql = "UPDATE {$this->db}sk_{$this->sklad}_ost\n SET ost=ost" . ($rs["type"] ? "-" : "+") . abs($rs["quant"]) . " " . "WHERE spr_id='{$rs["spr_id"]}'";
sql::query($sql);
$affected += sql::affected();
$sql = "DELETE FROM {$this->db}sk_{$this->sklad}_dvizh \n WHERE id='{$delete}'";
sql::query($sql);
$affected += sql::affected();
return $affected;
}
示例10: delete
public function delete($delete)
{
$affected = 0;
$sql = "DELETE FROM tz WHERE id='{$delete}'";
sql::query($sql);
$affected += sql::affected();
// удаление связей
$sql = "SELECT * FROM posintz WHERE tz_id='{$delete}'";
$res = sql::fetchAll($sql);
foreach ($res as $rs) {
$delete = $rs["id"];
$sql = "DELETE FROM posintz WHERE id='{$delete}'";
sql::query($sql);
$affected += sql::affected();
}
return $affected;
}
示例11: delete
public function delete($delete)
{
$affected = 0;
$sql = "DELETE FROM customers WHERE id='{$delete}'";
sql::query($sql);
$affected += sql::affected();
// удаление связей
// TODO: Удаллить блоки и позиции в блоках, а также платы
// удалить вязанные заказы и тз
$sql = "SELECT * FROM orders WHERE customer_id='{$delete}'";
$res = sql::fetchAll($sql);
foreach ($res as $rs) {
// удаление
$delete = $rs["id"];
$sql = "DELETE FROM orders WHERE id='{$delete}'";
sql::query($sql);
$affected += sql::affected();
// удаление связей
$sql = "SELECT * FROM tz WHERE order_id='{$delete}'";
$res1 = sql::fetchAll($sql);
foreach ($res1 as $rs1) {
// удаление
$delete = $rs1["id"];
$sql = "DELETE FROM tz WHERE id='{$delete}'";
sql::query($sql);
$affected += sql::affected();
// удаление связей
$sql = "SELECT * FROM posintz WHERE tz_id='{$delete}'";
$res2 = sql::fetchAll($sql);
foreach ($res2 as $rs2) {
$delete = $rs2["id"];
}
$sql = "DELETE FROM posintz WHERE id='{$delete}'";
sql::query($sql);
$affected += sql::affected();
}
}
return $affected;
}
示例12: delete
public function delete($id)
{
$sql = "DELETE FROM users__settings_types WHERE id='{$id}'";
sql::query($sql);
return sql::affected();
}
示例13: delete
public function delete($id)
{
$sql = "DELETE FROM " . $this->maintable . " WHERE id='{$id}'";
sql::query($sql);
return sql::affected();
}
示例14: usezadel
/**
* Использует задел, снимает с задела
* @param int $rec массив из запроса getZadelByPosintzId
* @return int колличество обработаных записей
*/
public function usezadel($rec)
{
$res = 0;
$zds = explode(',', $rec["zds"]);
foreach ($zds as $value) {
list($id, $count) = explode('-', $value);
if ($rec["use"] < $count) {
$sql = "UPDATE zadel SET number=number-{$rec["use"]} WHERE id='{$id}'";
} else {
$sql = "DELETE FROM zadel WHERE id='{$id}'";
}
sql::query($sql);
$res += sql::affected();
$rec["use"] -= $count;
if ($rec["use"] <= 0) {
break;
}
}
return $res;
}
示例15: deleteComment
public function deleteComment($id)
{
$sql = "DELETE FROM comments WHERE id='{$id}'";
sql::query($sql);
return sql::affected();
}