Can someone please help me with this code I'm having major problems with
arrays. This code is part of a function I'm writing to deal with an array
returned from a HTML form of check boxes so if anyone has an example of this
sort of thing I'd appreciate a look at it. Anyway Code follows :

//Reading from a data base
$db = mysql_connect("$DB_Server", "$DB_Login, $DB_Password");
 mysql_select_db("$DB_Name",$db);
 $results = mysql_query("SELECT option_type, code FROM options WHERE
code='000' ORDER BY option_type",$db);
 mysql_fetch_array($results);
// From what  understand I should have an array some thig like this:
// ("Size"=>"A4" , "Size" => "A3", "Size"=>"A5", "Colour"=>"Red", etc..);
 $types = array_values($results);
// OK so now I think I have an array like this:
// ("A4" , "A3", "A5", "Red", etc..);
  while ($type =array_pop($types)){
   echo $type."<br>";
 }
// Now I'm expecting this list to be printed to be outputted
A4
A5
A3
Red
etc...

I'm figureing that this would be a good way to retreive a listing from the
web site arrays and test and insert them one by one.

/// The table options

option_type || code || option_preferences
Size || 000 || A4
Size || 000 || A3
Size || 000 || A5
Colour || 000 || Red
Colour || 000 || Blue
Colour || 000 || Green

Reply via email to