Search Results

Search found 2 results on 1 pages for 'arrgggg'.

Page 1/1 | 1 

  • php - sort the unsorted text file and rewrite to same text file in sorted order

    - by arrgggg
    Hi, I have a question. I am in process of learning how to read/write files, but having little trouble trying to do both at the same time in same php script. I have a text file with words like this, Richmond,Virginia Seattle,Washington Los Angeles,California Dallas,Texas Jacksonville,Florida I wrote a code to sort them in order and this will display in sort order by City. <?php $file = file("states.txt"); sort($file); for($i=0; $i<count($file); $i++) { $states = explode(",", $file[$i]); echo $states[0], $states[1],"<br />"; } ?> From this, how can I rewrite those sorted information back into the states.txt file? Thanks for your help.

    Read the article

  • php / mysql pagination

    - by arrgggg
    Hi, I have a table with 58 records in mysql database. I was able to connect to my database and retrive all records and made 5 pages with links to view each pages using php script. webpage will look like this: name number john 1232343456 tony 9878768544 jack 3454562345 joe 1232343456 jane 2343454567 andy 2344560987 marcy 9873459876 sean 8374623534 mark 9898787675 nancy 8374650493 1 2 3 4 5 that's the first page of 58 records and those 5 numbers at bottom are links to each page that will display next 10 records. I got all that. but what I want to do is display the links in this way: 1-10 11-20 21-30 31-40 41-50 51-58 note: since i have 58 records, last link will display upto 58, instead of 60. Since I used the loop to create this link, depending on how many records i have, the link will change according to the number of records in my table. How can i do this? Thanks.

    Read the article

1