I have this table :
Row 1 : col1 col2 col3 col4 col5 ...etc...
Row 2 : col1 col2 col3 col4 col5 ...etc...
...etc...
I want to compare every col on each row to see if in that row is something duplicate. Example : col1 == col2 or if col1 == col 3 ... etc ... col 2 == col1 ; or col 2 == col 4 etc.
If there's a match on some colomns , I want the code to echo the id of the row and colomns that matches and from an array of multiple options of numbers that i give to select one that is not present in the row and to update there.
In final after running all the rows for each of the i want to see if was unique columns or duplicate.
Example of perfect echo :
// example of array :$array(1,2,3,4,5,etc);
Row 1 : unique
Row 2 : unique
Row 3 : duplicate col 2 = col 5, replacing col 2 with " unique number from array " .The row is now unique and updated ;
I tried :
$search_data = mysqli_query("select * from mestesug where id != 0 "))
while ($select_data = mysqli_fetch_array($search_data))
{for(i=1 i=n i++)
for(j=1 j=n j++)
SELECT * FROM mestesug WHERE COL1, COL2, COL3, COL4 IN
(SELECT COL1, COL2, COL3, COL4 FROM mestesug );
If $select_data['col1'] == $select_data['col2']
echo 'Duplicate' else echo 'Unique';}
It doesn't work .. help Please :)