Jump to content

MPM

Members
  • Posts

    10
  • Joined

  • Last visited

Posts posted by MPM

  1. You can't just paste the example code in as they are using different variable names to you.  You have to learn the principles and then apply them.  The steps are:

    1. connect (you do)
    2. select the data from the table (you did int he first example)
    3. extract a row from that data (as mentioned no need for a loop for the first test just get one row)
    4. extract a single item from that array
    5. echo that item

    Or replace 4 and 5 with a print_r of the array.

  2. Mac's point is still valid though.  You do not need to store whether someone is a member.  You just query the current date against their/the membership date when you need to know.  It is trivial that way and MUCH more useful and flexible.  It allows you to later add queries for automated reminders as memberships dates come closer and more.

    It is one of the fundamental principles of database design rather than a programming issue.

  3. I for one still have no idea what you are talking about.  I did notice that this:

    if ($dateTime = new DateTime('2019-07-19'))

    will always be true as there is only one equals so it assigns the new date (which seems fair) so why is it an if?

    A general tip is to try to use SQL for dates as it is much easier.

  4. The challenge with PHP is that you need to understand HTML, PHP and SQL to get anythign useful done and if you are shaky on any of that it is hell to track down problems.  Your HTML is shaky and that suggests you might need some more time on that before you move on but having said that your code looks fine apart from the issue already mentioned by Barand.  It should work once you remove the if statement.

    If you want to have another go here is a page I wrote on the subject for 16 year olds.  The site was written to be followed start to end but I think the page makes sense on it's own (especially if you follow the link to the place I explained how to create a form.

    https://www.yourwebskills.com/page.php?page=124

×
×
  • 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.