Jump to content

joshm101

New Members
  • Content Count

    7
  • Joined

  • Last visited

Community Reputation

0 Neutral

About joshm101

  • Rank
    Newbie
  1. joshm101

    Need help finding the right query (basic)

    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>
  2. 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.
  3. joshm101

    Need help with this script

    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
  4. joshm101

    Need help with this script

    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.
  5. joshm101

    Need help with this script

    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.
  6. joshm101

    Need help with this script

    Sorry guys, found the error. I needed to add: if(empty($_SESSION['password'])). I am new here, please be nice
  7. joshm101

    Need help with this script

    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();
×

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.