Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's a rough guideline (I won't go in the specifics because it's homework after all) and I'll keep the assumption you're not allowed to use anything different than text file but can create/delete as many of them as you wish.</p> <ol> <li>parse the activity txt file, using <code>file(...)</code> with the proper flags set</li> <li>build an array which key are the activities "IDs" (numberOne, numberTwo, etc) and value is another array containing the activity details. You may find handy <code>explode()</code> here.</li> <li>For each activity create a file dedicated to it (if it doesn't exist already, of course). This file will contain the names of the registered users that booked the activity. I suggest you to write one name per line in this file.</li> <li><p>when somebody press the "book activity" button, you'll have to do the following steps:</p> <ul> <li>Check if the requested activity file exists. if it doesn't, create an empty one.</li> <li>Count the current number of booked users and compare it with the maximum allowed</li> <li>If it's less, add the new user to the file, otherwise reject the booking</li> </ul></li> <li><p>To show the list of the booked users, simply read the file contents from each activity file. You may find useful <code>implode()</code> this time.</p></li> </ol> <p>I hope this will help you finding the right track. A last note, text files aren't designed to do this: a small database is easier to use, more fun to learn and more useful for your future.</p> <p>References:</p> <ul> <li><a href="http://www.php.net/manual/en/function.file-put-contents.php" rel="nofollow">How to create a file with <code>file_put_contents(...)</code></a></li> <li><a href="http://www.php.net/manual/en/function.file.php" rel="nofollow">How to read a file with <code>file(...)</code></a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload