Jump to content

joshm101

Members
  • Posts

    16
  • Joined

  • Last visited

Everything posted by joshm101

  1. Can anyone help me re-write this? Thanks
  2. The events table is separate. It is connected to the Calendar which is for just adding notes to the calendar, nothing special.
  3. Please see the files I am using. https://www.dropbox.com/s/5kk18az68ic402v/Bowls Program.zip?dl=0 There is an exported MySQL file in there to use in phpmyadmin. Database will need to be created in phpmyadmin called bowls_program The navigation isn't properly coded as of yet. It just has dummy data. If you goto the bowlersinfo folder, my scripts are in there to use. My aim: To create a form that can input records into the database and can create, view, edit and delete data. I want an automated function for the Membership Status. I don't have the exact date as of yet so just anything in the future will do for testing purposes. When the date gets to e.g. 2019-07-20 the membership will reset back to non member and then once the bowlers purchase the new membership, we can update as we go. I would ideally like the SQL query to be automated to the same date every year. Hope this helps.
  4. It resets for all members back to non member on the renewal date. There is no counting of days.
  5. My background is 1 year study of PHP, MySQL and I am fairly new with the date functions. I am building a free project for a Lawn Bowling Club. I have a Table that shows the input data from the form fields and this is the area of the paid membership status. So when the date gets to (Sometime next year, just a dummy date was used) the date provided, I would like the status value to go back to Non Member, instead of still being financial in the database.
  6. Here is where I am currently at: if ($dateTime > new DateTime('2019-06-26')) { if($stmt->rowCount() > 0) { $sql = "UPDATE bowlers_info SET status = 'Non Member'"; $stmt = $this->db->prepare($sql); $result = $stmt->execute(); } print "<option>Full Member</option>"; print "<option>Social Member</option>"; print "<option selected>Non Member</option>"; }
  7. Sorry about that. I want the select input option changed in the database when the Date is equal to the date given.
  8. I am a PHP newbie and need some help. I have a select input that requires some php date coding. Any help would be much appreciated. PLUS, I am in Australia so I'm not sure if there is any confliction when writing the date. <select style="height:100px;" name="status[]" id="status[]" multiple> <?php $statusstring = implode(",", $status); $status = $_SESSION['status']; if ($dateTime = new DateTime('2019-07-19')) { print "<option>Full Member</option>"; print "<option>Social Member</option>"; print "<option selected>Non Member</option>"; } else if ($status == 'Full Member') { print "<option selected>Full Member</option>"; print "<option>Social Member</option>"; print "<option>Non Member</option>"; } else if ($status == 'Social Member') { print "<option>Full Member</option>"; print "<option selected>Social Member</option>"; print "<option>Non Member</option>"; } else if ($status == 'Non Member') { print "<option>Full Member</option>"; print "<option>Social Member</option>"; print "<option selected>Non Member</option>"; } else { print "<option>Full Member</option>"; print "<option>Social Member</option>"; print "<option>Non Member</option>"; } ?> </select>
  9. This is what I have: <select name="message_date" id="message_date"> <option value="0">Select a Date</option> <?php date_default_timezone_set('Australia/Melbourne'); $sunday= date("N"); $sunday=7 - $sunday; $sunday_increment = new DateInterval('P'.$sunday .'D'); $sevendays_increment = new DateInterval('P7D'); $d0 =new DateTime(); $d0->add($sunday_increment); for($i=date('W');$i<53;$i++) { $sundate= $d0->format("Y-m-d"); $d0->add($sevendays_increment); print "<option value='$sundate'>$sundate</option>"; } ?> </select>
  10. Ok I am pretty new with databases, I am currently writing a PHP/MySQL program that: 2 tables, a form with date input from a select. I need data from both tables. Here is my SQL Query: $sql = "SELECT sd.sponsor_id, sd.sp_name FROM sponsor_details as sd INNER JOIN sponsor_message as sm on sd.sponsor_id = sm.sponsor_id WHERE message_date = 'Whatever the date from the form input'"; This is where the problem is. I don't know how to get a form data match with an SQL record. Any help would be much appreciated thanks.
  11. Thanks maxxd, I wasn't knocking your logic I just didn't give you enough information.(My fault). However I do have another question. Please see my scripts attached. Every time I seem to access the database through xampp when running a script, it logs me out of my logged in session. I can't find the problem. Any help would be much appreciated thanks. https://www.dropbox.com/sh/gabmonzk0rbawhm/AAAZPJIFJPV9aM-yUGMPfitoa?dl=0
  12. the data is coming from a different php script. So therefore I thought to get the data from another page of a form. Using SESSION works for me.
  13. I have a College Project which is to create a backend system that can manipulate the logged in users information. I wanted to have update functionality as an admin to manipulate the users details. Therefore the hashed password was giving me troubles. If I update the users details when the password field is empty, I don't want it to run the SQL wiith the password field. But if there is something in that field, I would like to execute the sql statement with the hashed password field.
  14. Sorry guys, found the error. I needed to add: if(empty($_SESSION['password'])). I am new here, please be nice
  15. Hello, I am new here. Looking for some help please. I am trying to work around the hashed password once the update button has been refreshed. e.g. if the form field is empty, then the $sql statement does not run with $param_password. If the form field has any characters, then run the other statement. Not sure if my syntax is correct, it seems to just hash it every time. Any help would be great thanks. if($stmt->rowCount() > 0) { $param_password = password_hash($this->password, PASSWORD_DEFAULT); // Creates a password hash if(empty(['password'])) { $sql = "UPDATE users SET username = '$this->username', status = '$this->status' WHERE id = $this->id"; } else { $sql = "UPDATE users SET username = '$this->username', password = '$param_password', status = '$this->status' WHERE id = $this->id"; } $stmt = $this->db->prepare($sql); $result = $stmt->execute();
×
×
  • 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.