小编Che*_*tan的帖子

删除MySQL中的重复行

我有一个包含以下字段的表:

id (Unique)
url (Unique)
title
company
site_id
Run Code Online (Sandbox Code Playgroud)

现在,我需要删除具有相同的行title, company and site_id.一种方法是使用以下SQL和脚本(PHP):

SELECT title, site_id, location, id, count( * ) 
FROM jobs
GROUP BY site_id, company, title, location
HAVING count( * ) >1
Run Code Online (Sandbox Code Playgroud)

运行此查询后,我可以使用服务器端脚本删除重复项.

但是,我想知道是否只能使用SQL查询来完成.

mysql sql duplicates

351
推荐指数
15
解决办法
35万
查看次数

用于在PHP中读取文件的最少内存密集型方法

我正在使用Php中的file()函数读取包含大约50k行的文件.但是,由于文件内容作为数组存储在内存中,因此会发出内存不足错误.还有其他方法吗?

而且,存储的行的长度是可变的.

这是代码.该文件也是700kB而不是mB.

private static function readScoreFile($scoreFile)
{
    $file = file($scoreFile);
    $relations = array();

    for($i = 1; $i < count($file); $i++)
    {
        $relation = explode("\t",trim($file[$i]));
        $relation = array(
                        'pwId_1' => $relation[0],
                        'pwId_2' => $relation[1],
                        'score' => $relation[2],
                        );
        if($relation['score'] > 0)
        {
            $relations[] = $relation;
        }
    }

    unset($file);
    return $relations;
}
Run Code Online (Sandbox Code Playgroud)

php file

12
推荐指数
2
解决办法
9130
查看次数

将位图数据从Flex发送到Php

我想在Web服务器(LAMP)上保存我的Flex应用程序的屏幕截图.这是Flex代码:

    private function getBitmapData( target : UIComponent ) : BitmapData
        {
            var bd : BitmapData = new BitmapData( target.width, target.height );
            var m : Matrix = new Matrix();
            bd.draw( target, m );
            return bd;
        }
Run Code Online (Sandbox Code Playgroud)

现在,如何将此数据发送/接收到服务器?

php apache-flex

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

标签 统计

php ×2

apache-flex ×1

duplicates ×1

file ×1

mysql ×1

sql ×1