public function add($tableName, $data, $query) { if ($tableName != '') { $createTime = date("Y-m-d H:i:s"); $mysql = new mysql_class(); $thisId = -1; $mysql->enableCache = FALSE; $mysql->directQuery("select `id` from `cache` where `tableName` = '{$tableName}' and `query` = '{$query}' ", $q); if ($r = $mysql->fetch_array($q)) { $thisId = $r['id']; } if ($thisId > 0) { $mysql->directQueryx("update `cache` set `data` = '" . serialize($data) . "' where `id` = '{$thisId}'"); } else { $ln = $mysql->ex_sqlx("insert into `cache` (`tableName`,`data`,`createTime`,`query`) values('{$tableName}','" . serialize($data) . "','{$createTime}','{$query}') ", FALSE); $thisId = (int) $mysql->insert_id($ln); $mysql->close($ln); } $this->id = $thisId; $this->tableName = $tableName; $this->data = $data; $this->query = $query; $this->createTime = $createTime; $this->viewCount = 1; } return $this->id; }
function edit_item($id, $feild, $value) { if ($feild == 'frase') { $mysql = new mysql_class(); $mysql->ex_sql("select `id` from `access_det` where `acc_id` = (select `acc_id` from `access_det` where `id`={$id}) and `frase` = '{$value}'", $q); if (!($r = $mysql->fetch_array($q))) { $mysql->ex_sqlx("update `access_det` set `frase` = '{$value}' where `id`={$id}"); } } else { $mysql->ex_sqlx("update `access_det` set `{$feild}` = '{$value}' where `id`={$id}"); } }
function loadGrooh($inp = -1) { $out = null; $mysql = new mysql_class(); $inp = (int) $inp; $mysql->ex_sql("select `name`,`id` from `grop` order by `name`", $q); while ($r = $mysql->fetch_array($q)) { if ((int) $r["id"] != $inp) { $out[$r["name"]] = (int) $r["id"]; } } return $out; }
public function loadList($table, $val, $text, $where) { $out = array(); $mysql = new mysql_class(); $mysql->ex_sql("select `{$val}`,`{$text}` from `{$table}` where {$where} ", $q); while ($r = $mysql->fetch_array($q)) { $out[$r[$val]] = $r[$text]; } return $out; }
$customer_id = isset($_REQUEST["customer_id"]) ? (int) $_REQUEST["customer_id"] : -1; } else { $customer_id = (int) $_SESSION[$conf->app . "_customer_id"]; } $report_type = isset($_REQUEST["report_type"]) ? (int) $_REQUEST["report_type"] : 0; $grid = new jshowGrid_new("customer_daryaft", "grid1"); switch ($report_type) { case 0: //-------mohasebe mande az ghabl------------ $mande_azghabl = "SELECT SUM(`mablagh`*`typ`) as `mande` FROM `customer_daryaft` where DATE(`tarikh`) < '{$saztarikh}' and `typ`<>0 "; if (isset($_REQUEST["customer_id"]) && (int) $_REQUEST["customer_id"] != -2) { $mande_azghabl .= " and `customer_id` = '" . (int) $_REQUEST["customer_id"] . "' "; } $mysql->ex_sql($mande_azghabl, $qmand); $mande_ghabl_value = 0; if ($rmand = $mysql->fetch_array($qmand)) { $mande_ghabl_value = $rmand['mande']; } $grid->addFeild("id"); $grid->addFeild("id"); $grid->addFeild("id"); $grid->fieldList[5] = "id"; $grid->index_width = '30px'; $grid->width = '99%'; $grid->columnHeaders[0] = null; $grid->columnHeaders[1] = "مشتری(آژانس)"; $grid->columnHeaders[2] = null; $grid->columnHeaders[3] = null; $grid->columnHeaders[4] = "تاریخ"; $grid->columnHeaders[5] = "شرح سند"; $grid->columnHeaders[6] = "شماره سند";