示例#1
0
        } else {
            $vals['brand_id'] = $pdb->GetOne("SELECT id FROM {$tb_prefix}brands WHERE name='" . $_POST['brand_name'] . "'");
        }
    }
    if (isset($_POST['price']['product_name'])) {
        if (!pb_strcomp($_POST['price']['product_name'], $_POST['product_name'])) {
            $vals['product_id'] = $pdb->GetOne("SELECT id FROM {$tb_prefix}products WHERE name='" . $_POST['price']['product_name'] . "'");
        } else {
            $vals['product_id'] = $pdb->GetOne("SELECT id FROM {$tb_prefix}products WHERE name='" . $_POST['product_name'] . "'");
        }
    }
    //$vals['industry_id'] = PbController::getMultiId($_POST['industry']['id']);
    $vals['area_id'] = PbController::getMultiId($_POST['area']['id']);
    if (!empty($id)) {
        $vals['modified'] = $time_stamp;
        $result = $productprices->save($vals, "update", $id);
    } else {
        $vals['created'] = $vals['modified'] = $time_stamp;
        $result = $productprices->save($vals);
    }
    if (!$result) {
        flash();
    }
}
$amount = $productprices->findCount(null, $conditions, null);
$joins[] = "LEFT JOIN {$tb_prefix}members m ON Productprice.member_id=m.id";
$page->setPagenav($amount);
$fields = "Productprice.id AS id,Productprice.title AS title,Productprice.units AS units, Productprice.price AS price,Productprice.currency AS currency,m.username AS name";
$result = $productprices->findAll($fields, $joins, $conditions, "Productprice.id DESC", $page->firstcount, $page->displaypg);
uaAssign(array("ByPages" => $page->pagenav));
setvar("Items", $result);