$name = mysql_num_rows($result);
$i = 0;
while($i < $name){  
    $nameAll = mysql_result($result, $i);           

you should use code in the first example here.

$sql = "SELECT id as userid, fullname, userstatus 
        FROM   sometable
        WHERE  userstatus = 1";

    $result = mysql_query($sql);

    // While a row of data exists, put that row in $row as an associative array
    // Note: If you're expecting just one row, no need to use a loop
    // Note: If you put extract($row); inside the following loop, you'll
    //       then create $userid, $fullname, and $userstatus
    $values = array(); 
    while ($row = mysql_fetch_assoc($result)) {

        $values[] = $row["fullname"];