小编Ogn*_*j3n的帖子

MySQL显示奇怪的结果

我有一个名为的表tabela1512823699024883,如下所示: 在此输入图像描述

我在其上运行如下查询:

SELECT * FROM tabela1512823699024883 WHERE `age` = 'male'
Run Code Online (Sandbox Code Playgroud)

此查询没有意义,因为age列是int类型,我string在查询中查找值,但MySQL仍然不返回任何空行.以下是返回的查询: 在此输入图像描述 所以agerow male在返回的行中都不包含值.这怎么可能?

php mysql

8
推荐指数
2
解决办法
587
查看次数

从 wordpress 中删除未使用的样式

我正在尝试从我的 wordpress 网站的所有帖子/页面中出列/注销不需要的样式(WooCommerce,联系表 7)。

尝试了官方WooCommerce 的方法来禁用这些额外的样式和脚本,但由于样式仍在源代码中加载并且 Google PageSpeed Insights 仍将它们显示为正在呈现,因此不会使它们出列;所以:

add_filter( 'woocommerce_enqueue_styles', 'jk_dequeue_styles' );
function jk_dequeue_styles( $enqueue_styles ) {
    unset( $enqueue_styles['woocommerce-general'] );    // Remove the gloss
    unset( $enqueue_styles['woocommerce-layout'] );     // Remove the layout
    unset( $enqueue_styles['woocommerce-smallscreen'] );    // Remove the smallscreen optimisation
    return $enqueue_styles;
}

// Or just remove them all in one line
add_filter( 'woocommerce_enqueue_styles', '__return_false' );
Run Code Online (Sandbox Code Playgroud)

functions.php不工作。我也尝试像这样删除它们:

function remove_assets() {
    wp_dequeue_style('wc-block-vendors-style-css');
    wp_deregister_style('wc-block-vendors-style-css');
}
add_action( 'wp_print_styles', 'remove_assets', PHP_INT_MAX );
Run Code Online (Sandbox Code Playgroud)

指向特定的样式 idwc-block-vendors-style-css …

css php wordpress woocommerce

8
推荐指数
1
解决办法
385
查看次数

从 jQuery 中复选框的数组值中删除

我有一个这样的复选框:

while($userRow=$resultForUsers->fetch_assoc()){
      $nameOfUser=$userRow['users_name'];
      $userId=$userRow['user_facebook_id'];
      $userFBPicture=$userRow['users_picture'];
      echo "
      <tr class='tr-data-users'>
      <td class='text-center'>
      <input type='checkbox' class='checkbox' onclick='if(this.checked){selo(this.value)}else{izbaci(this.value)}' value=$userId>
      </td>
Run Code Online (Sandbox Code Playgroud)

因此,对于我数据库中的每个用户,我都有一个复选框,其中包含他的 id 值。我需要一个数组中所有选中用户(即复选框)的 ID。我是这样做的:

<input type='checkbox' class='checkbox' onclick='if(this.checked){put(this.value)}else{remove(this.value)}' value=$userId>
 var  niz={};
    var index=0;
        function put(o){
            niz[index++]=o;
            console.log(niz);
        }
Run Code Online (Sandbox Code Playgroud)

因此,console.log现在显示所有选中复选框的 ID。我想要做的是,如果未选中复选框,则从数组中删除该 id(即 chechbox 值)。我是这样试的:

onclick='if(this.checked){put(this.value)}else{remove(this.value)}'
 var  niz={};
    var index=0;
        function put(o){
            niz[index++]=o;
            console.log(niz);
            remove(o,niz);
        }

        function remove(o,niz){
            if($.inArray(o,niz)){
                console.log('radim');
                var indexNiza= $.inArray(o,niz);
               niz= $.grep(niz,function(a,o){
                   return (a!=o);
               });
            }
        }   
Run Code Online (Sandbox Code Playgroud)

如您所见,else如果未选中复选框并从数组中删除该 id,这部分应该处理,但它不起作用。真的很感激这方面的帮助。

javascript arrays checkbox jquery

4
推荐指数
1
解决办法
1583
查看次数

标签 统计

php ×2

arrays ×1

checkbox ×1

css ×1

javascript ×1

jquery ×1

mysql ×1

woocommerce ×1

wordpress ×1