Thứ Ba, 17 tháng 3, 2026

Nhập bài viết trong CKEditor nhưng bị lỗi do dấu nháy

 🔥 Giải thích dễ hiểu

Copy text bình thường → không có ' → OK

Copy HTML có CSS → có ' → vỡ SQL → không lưu / lưu rỗng

👉Input SQL

$content = addslashes($_POST['txt_mieuta']);

👉Output

echo stripslashes($data[0]["content"]);

🚀 Tốt hơn (nếu muốn chuẩn hơn chút)

Dùng:

$content = mysql_real_escape_string($_POST['txt_mieuta']);

Thứ Sáu, 13 tháng 3, 2026

Flex co giãn dòng đầu tiên

 

## HTML

<div class="order-row">
        <div>#</div>
        <div>Tên sản phẩm</div>
        <div>Số lượng</div>
        <div>Giá</div>
</div>

## CSS

.order-row,
 .items-orders{
    display:flex;
}

.order-row > div:first-child,
.items-orders > div:first-child{
    flex:0 0 60px;
}

.order-row > div,
.items-orders > div{
    flex:1;
}

## NOTE

flex:0 0 60px nghĩa là:

grow = 0 (không giãn)

shrink = 0 (không co)

basis = 60px

→ cột đầu luôn 60px


Hiệu ứng hover div load text lên

 

**** HTML

<div class="hover-box-2">

    <span class="default-text">141.001 VNĐ</span>

    <span class="hover-text">Xem Đơn hàng</span>

</div>

**** CSS

.hover-box-2 {

    position: relative;

    overflow: hidden;

    /* width: 240px; */

    width: 180px;

    height: 50px;

    background: linear-gradient(135deg, #ffe4ec, #fff0f5);

    border-radius: 12px;

    text-align: center;

    cursor: pointer;

    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);

    margin: 0 auto;

    transition: transform 0.3s ease;

}

.hover-box-2:hover {

    transform: scale(1.03);

}

.hover-box-2 .default-text {

    top: 0;

    color: #444;

    opacity: 1;

}

.hover-box-2:hover .default-text {

    top: -100%;

    opacity: 0;

}

.hover-box-2 .hover-text {

    top: 100%;

    color: #e91e63;

    opacity: 0;

}

.hover-box-2:hover .hover-text {

    top: 0;

    opacity: 1;

}

.hover-box-2 .default-text, .hover-box-2 .hover-text {

    position: absolute;

    width: 100%;

    left: 0;

    transition: all 0.4s ease-in-out;

    line-height: 50px;

    font-size: 18px;

    font-weight: 600;

}

Thứ Năm, 12 tháng 3, 2026

Lấy userid duy nhất trong vòng lặp + Câu lệnh sql FIND_IN_SET

 Ví dụ:

pid 1 → userid 10
pid 2 → userid 10
pid 3 → userid 9

→ kết quả cần:

9,10 -------------------- $sum = 0;
$json_data = array();
$list_userid = array();

foreach($data_sp as $sp){

$total = $sp['g_count'] * $sp['g_price'];
$sum += $total;
$pid = $sp['g_pid'];

$shopemail = RETURN__CatalogSPShop__shopname($pid);
$userid = RETURN__UserID__Email($shopemail);

/* lưu userid */
$list_userid[] = $userid;

$json_data[] = array(
"gid" => $sp['gid'],
"g_pid" => $sp['g_pid'],
"g_price" => $sp['g_price'],
"g_point" => $sp['g_point'],
"g_count" => $sp['g_count'],
"g_code" => $sp['g_code'],
"g_title" => $sp['g_title'],
"total" => $total,
"userid" => $userid,
"is_view" => 0
);
}

/* lấy userid duy nhất */

$list_userid = array_unique($list_userid);

/* nếu muốn dạng chuỗi */

$userid_string = implode(",", $list_userid);

echo $userid_string; -------------------- $list_userid = [10,10,9]

array_unique →

[10,9]

implode →

"10,9" ---------------------

$sql = "SELECT *
FROM orders
WHERE FIND_IN_SET('$userid', order_shopids)
ORDER BY order_date DESC";

$rs = mysql_query($sql);

Thứ Hai, 9 tháng 3, 2026

Kéo xuống position-sticky giữ lại khi kéo xuống

 




.search-left .list-filters {

    position: sticky;

    top: 10px;

    padding-inline-start: 10px;

    padding-inline-end: 19px;

    padding-bottom: 10px;

    box-sizing: border-box;

    overflow-y: auto;

    overflow-x: hidden;

    max-height: calc(100vh - 103px);

    flex-shrink: 0;

    border-inline-end: 1px solid #e6e6e6;

    padding-inline-end: 1px;

}

Thứ Ba, 3 tháng 3, 2026

Lỗi không upload file exel trong FCKeditor

 đường dẫn : Website/ Fckeditor/config.js

bỏ các đường dẫn khác 
config.filebrowserUploadUrl = site_live+'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files';

- là ok, cho uploads file xlsx, doc, docx

Thứ Hai, 2 tháng 3, 2026

ShopOrder - Show đơn hàng thuộc shopname

$shopid = $userid;

$sql = "SELECT * FROM  shop_orders";

$result = $db->sql_query($sql);

while($row = $db->sql_fetchrow($result)){

    $items = json_decode($row['order_text'], true);

    foreach($items as $item){

        if($item['shop_id'] == $shop_id){

            echo "Sản phẩm: ".$item['g_title'];

            echo " - Khách: ".$row['order_uname'];

            echo "<br>";

        }

    }

}