예제 #1
0
 public function checkdata($brandName, $modelName)
 {
     $bResule = false;
     if ($brandName != "" && $modelName != "") {
         $sql = "select a.* from " . DB_PREFIX . "model a left join " . DB_PREFIX . "brand b on a.brandcode=b.brandcode ";
         $sql .= " where b.brandname='{$brandName}' and a.modelname='{$modelName}'";
         //print_r($sql);
         $this->result = $this->db->query($sql);
         $rowsCount = $this->db->db_num_rows();
         //print_r($rowsCount);
         if ($rowsCount > 0) {
             $bResule = true;
         }
         //添加用户品牌机型数据
         $userAction = new UserBrandAndModelInfo();
         $userAction->addData($brandName, $modelName, $bResule ? 1 : 0);
         //print_r($bResule);
         mysql_free_result($this->result);
     }
     return $bResule;
 }
<?php

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 14-4-24
 * Time: 下午3:16
 */
header("Content-type: application/json");
require_once "../config/config.inc";
require_once "userbrandandmodelinfo.class.php";
$type = $_POST['type'];
switch (strtolower($type)) {
    case "delinfo":
        $items = $_POST['items'];
        $id = explode(",", $items);
        $userAction = new UserBrandAndModelInfo();
        foreach ($id as $ide) {
            $userAction->delData($ide);
        }
        unset($userAction);
        echo "1";
        break;
}
/*
$action=$_POST['action'];
$ar=array("names"=>$username,"actionname"=>$action);
echo json_encode($ar);
*/
예제 #3
0
require_once "../config/config.inc";
require_once "../lib/userbrandandmodelinfo.class.php";
$name = "";
$title = "机型品牌管理";
//当前页数
if (isset($_GET['page'])) {
    $curPageNum = (int) $_GET['page'];
} else {
    $curPageNum = 1;
}
if (isset($_GET['name'])) {
    $name = (int) $_GET['name'];
}
$pageSize = 15;
//定义每页显示数
$userModal = new UserBrandAndModelInfo();
$num = $userModal->getPagerListCount($name);
$page = ceil($num / $pageSize);
//总页数
//print_r($num.'-'.$page);
if ($curPageNum == 0) {
    $curPageNum = 1;
    //当前页数为1
}
if ($curPageNum > $page) {
    $curPageNum = $page;
    //当前页数为最大页数
}
$total = $num;
//总条数
$page = $page;