Determine if key values in two arrays are equal then update if they are
<p>I've taken up PHP programming as a hobby after work and kids. So, my appologies if this code is bogus...but I've been searching for awhile. Anyways, I am trying to compare the values in two arrays and...where each key value equals another I would like to update that value to '1'. So for example, in one array the values are (2, 4, 1) in the second they are (3, 4, 5). Afterwards the the values that would be in my sql column would be updated to (2, 1, 1). Here is my code. Thank you for any help! </p>

<pre><code>$array1 = mysql_fetch_array($x);
$array2 = mysql_fetch_array($x1);

foreach($array1 as $key =&gt; $value)
{
if($value == $array2[$key])
{
   $v = "UPDATE fXnumber SET xnumber = '1'";
   mysql_query($v);
}


}
</code></pre>
