小编did*_*ido的帖子

按多个条件在表中查找重复记录

+-------------------------+
| SKU  |  UPC  |   NAME   | INVID
+-------------------------+
| 001  |  111  |   NAME1  |  1
| 001  |  null |   NAME2  |  2
| 0-1  |  111  |   NAME3  |  3
| -01  |  111  |   NAME4  |  4
| 002  |  222  |   NAME5  |  5
| 002  |  null |   NAME6  |  6
| 003  |  333  |   NAME7  |  7
+-------------------------+
Run Code Online (Sandbox Code Playgroud)

我想通过两个标准在这个表中找到重复的记录.首先是SKU,第二个是UPC.在这种情况下,重复记录是[1,2,3,4]和[5,6].行[1,2]是重复的,因为sku数字是匹配的.行[1,3,4]是重复的,因为UPC编号是匹配的.第一个重复组应如下所示:

GROUP1*

+-------------------------+
| 001  |  111  |   NAME1  |  1
| 001 …
Run Code Online (Sandbox Code Playgroud)

php mysql

5
推荐指数
1
解决办法
263
查看次数

如何更改scrapy蜘蛛中的User_AGENT?

我写了一个蜘蛛从我的IP http://ip.42.pl/raw通过PROXY.这是我的第一只蜘蛛.我想更改user_agent.我从本教程中获得了信息http://blog.privatenode.in/torifying-scrapy-project-on-ubuntu

我完成了本教程中的所有步骤,这是我的代码.

settings.py

BOT_NAME = 'CheckIP'

SPIDER_MODULES = ['CheckIP.spiders']
NEWSPIDER_MODULE = 'CheckIP.spiders'

USER_AGENT_LIST = ['Mozilla/5.0 (iPhone; CPU iPhone OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B179 Safari/7534.48.3',
'Mozilla/5.0 (Linux; U; Android 4.0.3; ko-kr; LG-L160L Build/IML74K) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30',
'Mozilla/5.0 (Linux; U; Android 4.0.3; de-ch; HTC Sensation Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30',
'Mozilla/5.0 (Linux; U; Android 2.3; en-us) AppleWebKit/999+ (KHTML, like Gecko) Safari/999.9',
'Mozilla/5.0 (Linux; …
Run Code Online (Sandbox Code Playgroud)

python tor scrapy

5
推荐指数
1
解决办法
9946
查看次数

如果我有一组值,我该如何选中复选框?

我有以下的inptuts!

<input type="checkbox" value="1" />
<input type="checkbox" value="2" />
<input type="checkbox" value="3" />
<input type="checkbox" value="4" />
<input type="checkbox" value="5" />
Run Code Online (Sandbox Code Playgroud)

使用jQuery后,我希望我的结果如下所示:

<input type="checkbox" value="1" checked />
<input type="checkbox" value="2" />
<input type="checkbox" value="3" checked  />
<input type="checkbox" value="4" />
<input type="checkbox" value="5" checked />
Run Code Online (Sandbox Code Playgroud)

我使用以下代码,但它不起作用.

$(document).ready(function() { 
    var str = '1,3,5';
    var temp = new Array();
    temp = str.split(",");
    for (a in temp ) {
        //$('.check').valueOf().checked;
        $('.check').val(append(temp[a])).checked;
        //$('#c').append();
    }
});
Run Code Online (Sandbox Code Playgroud)

提前致谢!

arrays checkbox jquery checked

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

如何在两个字符之间获取字符串[string]?PHP

$string1 = "This is test [example]";
$string2 = "This is test [example][2]";
$string3 = "This [is] test [example][3]";
Run Code Online (Sandbox Code Playgroud)

我怎样才能得到以下结果?

For $string1 -> example
For $string2 -> example*2
For $string3 -> is*example*3
Run Code Online (Sandbox Code Playgroud)

php string

4
推荐指数
2
解决办法
7316
查看次数

如何将数据从CSV导入MySQL?

我有以下结构的csv文件:

    A   BA0011  U206    NAME    0000000000000149.00     000000.00  0000000000000118.93  S   N   N
    A   BB0011  U206    NAME    0000000000000150.00     000000.00  0000000000000118.93  S   N   N
    A   BC0011  U206    NAME    0000000000000151.00     000000.00  0000000000000118.93  S   N   N
    A   BD0011  U206    NAME    0000000000000152.00     000000.00  0000000000000118.93  S   N   N
    A   BE0011  U206    NAME    0000000000000153.00     000000.00  0000000000000118.93  S   N   N
Run Code Online (Sandbox Code Playgroud)

使用以下MySQL函数如何在MySQL表中导入第一列和第三列:

LOAD DATA INFILE 'data.csv' INTO TABLE tbl_name
  FIELDS TERMINATED BY \t' ENCLOSED BY '"'
  LINES TERMINATED BY '\r\n'
  IGNORE 1 LINES;
Run Code Online (Sandbox Code Playgroud)

我为我的英语道歉!

提前致谢 !

mysql csv import

3
推荐指数
1
解决办法
1万
查看次数

jQuery 更改 css 类

我有一个 jQuery 脚本的问题。我使用这个代码:

<span class="follow" data-id="<?=$m['id']; ?>" ></span>
Run Code Online (Sandbox Code Playgroud)

——

        $('.follow').click(function(){

        $.ajax({
            type: "POST",
            url:"../ajax/settings/follow.php", 
            async: false,
            dataType:'html',
            data: {'id':$(this).attr('data-id')},
            success:function(rs){
               $(this).removeClass("follow"); 
                $(this).addClass("unfollow"); 

            },

            error:function (xhr, ajaxOptions, thrownError){
                alert("ERROR !!!");
                alert(xhr.status);
                alert(ajaxOptions);
                alert(thrownError);

            }  
        });   

    });
Run Code Online (Sandbox Code Playgroud)

单击样式图像TICK的跨度更改为CROSS,并将attr class更改为unfollow。单击取消关注后必须更改为关注,但不起作用。

        $('.unfollow').click(function(){

        $.ajax({
            type: "POST",
            url:"../ajax/settings/follow.php", 
            async: false,
            dataType:'html',
            data: {'id':$(this).attr('data-id')},
            success:function(rs){
               $(this).removeClass("unfollow"); 
                $(this).addClass("follow"); 

            },

            error:function (xhr, ajaxOptions, thrownError){
                alert("ERROR !!!");
                alert(xhr.status);
                alert(ajaxOptions);
                alert(thrownError);

            }  
        });   

    });
Run Code Online (Sandbox Code Playgroud)

怎么了?

我为我的英语道歉!

ajax jquery

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

使用保留质量的php调整图片大小

我使用以下方法来调整图像大小:

 private function newDim($maxHeight, $maxWidth, $height, $width) {

        if(($width / $height) >= ($maxWidth / $maxHeight)){
                $nw = $maxWidth;
                $nh = $height * ($maxWidth / $width);
                $nx = round(abs($maxHeight - $nh) / 2);
                $ny = 0 ;
        }else {
            // by height
                $nw = $width*($maxHeight/$height);
                $nh = $maxHeight;
                $nx = 0;
                $ny = round(abs($maxWidth - $nw) / 2); ;
        }

        return array($nw,$nh,$nx,$ny);
    }
Run Code Online (Sandbox Code Playgroud)

之后我想保存这个图像.对于这种情况,我使用这种方法:

 public function upload($file_param_name) {
        $file_name = $_FILES[$file_param_name]['name'];
        $source_file_path = $_FILES[$file_param_name]['tmp_name'];
        $$this->ext = pathinfo($file_name, PATHINFO_EXTENSION);
        $ext = 'jpg'; …
Run Code Online (Sandbox Code Playgroud)

php resize image

0
推荐指数
1
解决办法
2221
查看次数

如何用PHP替换字符串中的特殊字符?

我有下面的字符串:

a&b.c'd,e f
Run Code Online (Sandbox Code Playgroud)

我怎么样

?_b_c_d_e_f
Run Code Online (Sandbox Code Playgroud)

看起来像正则表达式模式?

提前致谢 !

php regex

-6
推荐指数
1
解决办法
128
查看次数

标签 统计

php ×4

jquery ×2

mysql ×2

ajax ×1

arrays ×1

checkbox ×1

checked ×1

csv ×1

image ×1

import ×1

python ×1

regex ×1

resize ×1

scrapy ×1

string ×1

tor ×1