<?php
$constructors = array ('Renault', 'Citroen', 'Ferrari', 'Fiat', 'Seat', 'Honda', 'Toyota', 'Hyundai');
for ($u=0; $u< count ($constructors); $u++)
{
if ($u % 2 == 0)
{
echo 'Pair results:'. $constructors[$u].' ';
echo '<br />';
}
else
{
echo 'Odd results:'. $constructors[$u];
echo '<br />';
}
}?>
I have to insert the Pair result in one of the SQL Tables (Constructor1) and the Odd results in another of the tables (Constructor2) but as they are inside and if and else, i don't know how to do it. I tried with function but i noticed you can't use functions there. Any idea?
Example: $query = "INSERT INTO constructors (Constructor1, Constructor2) VALUES ('$constructors[$u]', '$constructors[$u]')";
Thanks for your help.