I have a problem with my code. I have the following code:
<?php
require('class/habeo.class.php');
$Habeo->DuplicateRegister('contatos', array('id'=>'1', 'id'=>'6'));
?>
This class duplicates the records I have in the database. It counts how many elements it has in the array and loopes to duplicate the id . The class that duplicates is as follows:
<?php
function($de, $condicao){
foreach($condicao as $campo=>$value){
$SQL = mysql_query('INSERT INTO {$de} ({$Columns})
SELECT {$Columns} FROM {$de}
WHERE {$campo}='{$value}');
}
}
?>
The problem is that it only loops with 1, and there are 2 records in the array.
I have seen that the error is because the array indices are the same name id and so are returning only 1, now when I change the name it returns 2.