Because I want to display it like this:


category1 (href anchor to category1 below)
category2
category3


category1
    link1
    link2
    link3

category2
    link1
    etc...



On 3/3/01 2:49 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:

> Addressed to: andrew <[EMAIL PROTECTED]>
>             [EMAIL PROTECTED]
> 
> ** Reply to note from andrew <[EMAIL PROTECTED]> Sat, 03 Mar 2001 14:26:30
> -0500
>>   
>> help! :)>
>>   
>> I'm trying to return a list of links under associated categories from a
>> database table that has the fields: "linkID, category, name, url".
>>   
>> I'm selecting the fields and then trying to construct a multi-dimensional
>> array so that the correct items get put into it (and then printed out):
>>   
> 
> Why build an array, and store ANOTHER copy of all the data in memory
> while the script runs?  That is just a waste of memory...
> 
> 
>  SELECT Category, Name, URL FROM Links ORDER BY Category, Name;
> 
> 
> 
> To display them:
> 
> $OldCategory = '';
> 
> while( list( $Category, $Name, $URL ) = mysql_fetch_row( $Result )) {
> 
>  if( $OldCategory != $Category ) {
>     print "Category Header $Category<BR>\n";
> 
>     $OldCategory = $Category;
>     }
> 
>  print "<A href=\"$URL\">$Name</a><BR>\n";
>  }
> 
> 
> 
> 
> 
> Rick Widmer
> Internet Marketing Specialists
> http://www.developersdesk.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to