Example #1
0
<?php

include "../../../system.php";
include "../../system.php";
include "../../../function/new_function.php";
include "ps_unit.php";
//System-----------------------------------------------------------
$now_table = $pro_size_relate_table;
$related_table = $pro_stock_table;
//System-----------------------------------------------------------
$tool = new My_Tool();
$sam = new guard();
$unit = new psize();
$id = $_POST['id'];
$unit->table = $now_table;
$unit->id = $id;
$unit->del();
//刪除關聯紀錄
$sql = "DELETE from `{$related_table}` where sid='{$id}'";
mysql_query($sql);
Example #2
0
<?php

include "../../../system.php";
include "../../system.php";
include "../../../function/new_function.php";
include "ps_unit.php";
//System-----------------------------------------------------------
$now_table = $pro_size_relate_table;
//System-----------------------------------------------------------
$tool = new My_Tool();
$sam = new guard();
$unit = new psize();
$upid = $_POST['upid'];
$sid = $_POST['sid'];
$sql = "select * from `{$pro_size_table}` where `id`='{$sid}'";
$res = mysql_query($sql);
$row = mysql_fetch_array($res);
$name = $row['name'];
$sql = "select * from `{$now_table}` where `upid`='{$upid}' and `sid`='{$sid}'";
$res = mysql_query($sql);
if (mysql_num_rows($res) == 0) {
    if (!empty($sid)) {
        $unit->table = $now_table;
        $unit->upid = $upid;
        $unit->name = $name;
        $unit->sid = $sid;
        $unit->add();
    }
}