Exemplo n.º 1
0
function insert_how($post_product_id, $post_how, $post_technical)
{
    $conn = connDB();
    $sql = "INSERT INTO tbl_product_custom (`product_id`, `how`, `technical`)\n                                      VALUES('{$post_product_id}', '{$post_how}', '{$post_technical}')\n\t\t\t";
    $query = mysql_query($sql, $conn) or die(mysql_error());
}
function update_how($post_how, $post_technical, $post_product_id)
{
    $conn = connDB();
    $sql = "UPDATE tbl_product_custom SET `how` = '{$post_how}', `technical` = '{$post_technical}' WHERE `product_id` = '{$post_product_id}'";
    $query = mysql_query($sql, $conn) or die(mysql_error());
}
function get_product_id_how($post_product_alias)
{
    $conn = connDB();
    $sql = "SELECT * FROM tbl_product WHERE `product_alias` = '{$post_product_alias}'";
    $query = mysql_query($sql, $conn) or die(mysql_error());
    $result = mysql_fetch_array($query);
    return $result;
}
if (isset($_POST['btn-product-detail'])) {
    // REQUEST VARIABLE
    $req_prod_how = $_REQUEST['product_alias'];
    // CALL FUNCTION
    $how_product_id = get_product_id_how($req_prod_how);
    // DEFINED VARIABLE
    $how = $_POST['how'];
    $technical = $_POST['technical'];
    update_how($how, $technical, $how_product_id['id']);
}
Exemplo n.º 2
0
            $def_type_page_title = $ct_default_type['page_title'];
            $def_type_page_description = $ct_default_type['page_description'];
            // PRODUCT TYPE
            insert_product_type_lang($lang_type_id, $def_product_id, $def_type_code, $lang_type_name, $def_type_price, $def_type_color_id, $lang_description, $def_type_weight, $def_type_new_arrival, $def_type_image, $def_type_order, $def_type_sold_out, $def_type_visibility, $def_type_delete, $def_type_alias, $def_type_page_title, $def_type_page_description, $lang_code);
        }
    }
    // END CHECK DML
    //}
    # ----------------------------------------------------------------------
    # HOW TO & TECHNICAL DATA
    # ----------------------------------------------------------------------
    // DEFINED VARIABLE
    if (isset($_POST['custom_lang_default_how'])) {
        $val_how = 'default';
    } else {
        $val_how = $_POST['how'];
    }
    if (isset($_POST['custom_lang_default_technical'])) {
        $val_tech = 'default';
    } else {
        $val_tech = $_POST['technical'];
    }
    // CHECK DML
    if ($check_how['rows'] > 0) {
        update_how($val_how, $val_tech, $def_product_id);
    } else {
        insert_how($def_product_id, $val_how, $val_tech, $lang_code);
    }
    $_SESSION['alert'] = 'success';
    $_SESSION['msg'] = 'Changes successfully saved.';
}