Splitting imploded array from mysql to variables in php
===

Ok basically I can't figure out how to get the imploded result from mysql back to a usable variable in php. The array is throwing me for a loop, and driving me nuts.

The checkboxes that are being dynamically created from the db:

    <input name="tournament_id[]" value="'.$row['tournament_id'].'" type="checkbox">'.$row['tournament_name'].'

The posted value getting imploded (no sql injection prevention implemented yet):

    $got_tournament_id = implode(",",$_POST['tournament_id']);

This gets inserted into mysql like this:

    id   user_id   tournament_id
    1    16942627  1,10

This is my mysql query to grab the imploded data:

    $query = ("SELECT tournament_id FROM tournament WHERE user_id=16942627");
    $result = mysql_query($query);
    while ($row = mysql_fetch_array($result)) {
    $got_it = $row['tournament_id'];	
    }
    $bust_him = var_dump(explode(",", $got_it));
    echo $bust_him;

The above using var_dump is returning the following:

    array(2) { [0]=> string(1) "1" [1]=> string(2) "10" }

Now this is where I am totally lost, and can't figure out what to do to get the values 1 and 10 from the array into individual variables. I have tried several ways to do it and I keep ending up with errors, or just the word array. I need some help if anybody can give some. Thanks in advance.


