Jump to content

bentwiener

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bentwiener's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. to everybody that helped me. a great big thank you , i was so focused on it and not listening, i could not see what was in front of my face or what was being said to me.
  2. Pandemikk - there is going to be over 500 profiles and 300 catagories, i have condensed the catagories from 300 to 8 to make it smaller to post, + i would need to add to the code everytime i add to the profile. making more work for me. MikeDean89 - your code only sorts by the $p_id, whitch i can do by just adding sort($lines); to the code that i already have like this. <?php $lines = file('database/profile.txt'); sort($lines); foreach($lines as $thisline){list($p_id,$p_status,$p_filestart,$p_filemodified,$p_first,$p_middle,$p_last,$p_nick) = explode('|',$thisline);{ $names []= $p_last.', '.$p_first.' '.$p_middle.$p_id.'.'; foreach($names as $value); {echo ''.$value.'<br>';}}} ?> the code is going to be used in a drop down box like this: Person <select name="person"> <option value=""></option> <?php $lines = file('database/profile.txt'); foreach($lines as $thisline){list($p_id,$p_status,$p_filestart,$p_filemodified,$p_first,$p_middle,$p_last,$p_nick) = explode('|',$thisline);{ $names []= $p_last.', '.$p_first.' '.$p_middle.$p_id.'.'; foreach($names as $value); {echo '<option>'.$value.'</option>';} }}?> </select> your help is not unappreciated, i thank you both for your help. but the code i have works great, i just need it to sort by $p_last. with over 500 profiles it would take allot of time to find a name in a drop box if they are not in alphabetical order.
  3. <?php $lines = file('database/profile.txt'); foreach($lines as $thisline){list($p_id,$p_status,$p_filestart,$p_filemodified,$p_first,$p_middle,$p_last,$p_nick) = explode('|',$thisline);{ $names = array(); $names []= $p_last.', '.$p_first.' '.$p_middle.'.'; sort ($names); foreach($names as $value); {echo ''.$value.'<br>';} }}?> this only list data in order placed in databse
  4. <?php $lines = file('database/profile.txt'); foreach($lines as $thisline){list($p_id,$p_status,$p_filestart,$p_filemodified,$p_first,$p_middle,$p_last,$p_nick) = explode('|',$thisline);{ $names = array(); $names []= $p_last.', '.$p_first.' '.$p_middle.'.'; foreach($names as $value); {sort($value);echo ''.$value.'<br>';} }}?> the code above gives me error: Warning: sort() expects parameter 1 to be array, string given
  5. im using flatfile only because i feel it will work better for the application im using. yes - i would like to sort by last name in alphabetical order. http://php.net/manual/en/function.sort.php been there and inserted sort() in every way i could think the error states - looking for array only could find string i try to never ask for help. i have been searching the net for 3 weeks and found lots of sort() functions i have tried every sort() function that i find and only get errors.
  6. it is displaying the lastnames in the order they are in the profile but do not know how to get it to sort by lastname - please help :'( <?php $lines = file('database/profile.txt'); foreach($lines as $thisline){list($p_id,$p_status,$p_filestart,$p_filemodified,$p_first,$p_middle,$p_last,$p_nick) = explode('|',$thisline);{ $names []= $p_last.', '.$p_first.' '.$p_middle.'.'; foreach($names as $value); {echo ''.$value.'<br>';}}} ?>
×
×
  • 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.