PHP dependant foreach loop
<p>What I am trying to accomplish here is to separate a firstname, lastname combo to store in a database. I already added the the new columns in the database to hold the first and last names. What I need to do now is to actually separate them and run an SQL update against the changes.</p>

<p>Can someone please give me a hand? Thanks.</p>

<p>Here is my code</p>

<pre><code>&lt;?php
$link = mysql_connect('localhost', 'root', '');
mysql_select_db("test",$link);

$sql = "SELECT * FROM new_users";
$result = mysql_query($sql);

while ($row = mysql_fetch_assoc($result))
{
    $foo[] = $row;
}

foreach($foo as $name)
{
    $_name[] = explode(',',$name['Name']);
    $_pan[] = $name['PANumber'];
}

foreach($_pan as $pan)
{
    foreach($_name as $name)
    {
        echo'&lt;pre&gt;';
        print_r($pan);
        echo'&lt;/pre&gt;';
    }
}
</code></pre>
