Jump to content

Grouping an array with a name?


rockinaway

Recommended Posts

Your question is far too vague to directly answer. You have to provide examples for a question like that.

But, it depends on your table structure, and how you want the array grouped exactly.

For instance, this:

while($row = mysql_fetch_assoc($results)) {
$arr[$row['title']] = $row['subject'];
}

Would work fine if your title was a primary key (and if my offhand coding was 100% accurate and without error).

The array would come out something like this:
$arr["PHP in 24 Hours"] = "PHP";
$arr["Learning PHP"] = "PHP";
$arr["Learning Perl"] = "Perl";

Just remeber that each "row" in an array has to have a unique key.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.