Hello Geeks,
Thanks for helping me out every time.
I stuck somewhere in code where i want to find duplicate data using laravel 5.
Let i have a table users and it have an ip field for ip address which store user ip when they register so now i want to find all the users who have same ip.
I am using laravel 5.
Also If you can tell me, I want a site where one computer can have only one registered account so how can i achieve this.
Thanks in advance
@toniperic bro it is showing just one result and i want all result having ip same like
7 users are there in database out of them 2 have the ip 255.255.30.12 , other 3 have ip 124.35.89.78 and the rest two have different ip respectively
So I want to grab all the users having ip address common so in this case we will get 5 users having ip 255.255.30.12 (in this case 2 users) and 124.35.89.78 (in this case 3 users) respectively and excluding the remaining two having different ip
Forgot about everything just tell me how can i get the duplicate data from table without passing any variable just as we use in my sql this query for any particular column
SELECT ip, COUNT(ip) AS occurrences
FROM users
GROUP BY ip
HAVING occurrences > 1;
Please tell me how to convert it into laravel 5 using eloquent
@constb bro getting error and by the way i also have User model
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ip' at line 1 (SQL: ip)