开发者

IP conflicts mysql

I am building a site where the users are allowed to have one account per IP.

I am looking for a way to display users with the same IP using PDO mysql...

Here is what I got...

$q = $dbc -> prepare ("SELECT login_ip FROM accounts");
$q -> execute();
$duplicate = $q -> fetch(PDO::FETCH_ASSOC);

This will fetch开发者_如何学编程 everyones' IP addresses. How can I then see if there is any exact matches and show them??


SELECT login_ip, COUNT(login_ip) AS occurences
FROM accounts
GROUP BY login_ip
HAVING ( COUNT(login_ip) > 1 )

This will list you all possible duplicate IPs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜