Jump to content

DanEthical

Members
  • Content Count

    72
  • Joined

  • Last visited

Community Reputation

1 Neutral

About DanEthical

  • Rank
    Regular Member

Profile Information

  • Gender
    Male
  • Location
    Victoria

Recent Profile Visitors

1,078 profile views
  1. Got it to work by using an If statement as such: if(mysqli_real_escape_string($con, $_GET['id']=="")){ $sql = "SELECT * FROM pages WHERE name = 'Home'"; $result = $con->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { Most likely not the most correct way to do it but it works.
  2. Thanks for pointing that out. Yes, I agree. It is only a project that will be fixed up as time goes on. For now I just want to get everything working and then I can modify MySQL code where required.
  3. Hi folks, I am in the middle of creating a CMS as a project. It's going pretty well so far but I am stuck and hoping to get some guidance. When loading the main website, I want the contents from "Home" in the database to display unless a menu item is clicked. Here is what I have so far: <?php include_once('includes/header.php'); require_once('admin/includes/config.php'); ?> <div class="hero-wrap" style="background-image: url('images/uluru.jpg');" data-stellar-background-ratio="0.5"> <div class="overlay"></div> <div class="conta
  4. hahaha Yep, this deserves Best Answer LOL, silly Irish boy here. Well, learnt something new. Thanks again.
  5. Got it. You guys are awesome. On submitting the form to add a new Maintenance Request, I have added an extra row for username. This tells the request who is logged in and what data to display. $sql = "INSERT INTO `maintenance_requests`(`driver_name`, `driver_email`, `fleet_number`, `speedo_reading`, `submit_date`, `issue_name`, `issue_description`, `issue_status`, `issue_priority`,`username`) VALUES ('".$driver_name."','".$driver_email."', '".$fleet_number."','".$speedo_reading."','".$submit_date."','".$issue_name."', '".$issue_description."', 'Open', 'Medium','".$username."')"; $link
  6. The username is tied to the logged in user. $username is in a session in the users table.
  7. No, username is not in this table. I am trying to get the data that username has submitted. I am presuming that having $_SESSION['username'] will help identify what user submitted it? Sure. Here is the whole file including the rewritten code from ginerjm: <?php require_once('templates/header.php'); require_once('templates/sidebar.php'); ?> <div id="page-wrapper" > <div id="page-inner"> <div class="row"> <div class="col-md-12"> <h2><i class="fa fa-wrench"></i> Mai
  8. Thank you so much for this and the explanation. Means a lot. I have put it in and it says "PREPARED STATEMENT FAILED".
  9. I have even changed it to use the OOP style statement from here: http://php.net/manual/en/mysqli.prepare.php Still the same.
  10. That is bloody strange. I have echo $_SESSION['username']; in the header and in index.php and they work. This page has everything that index.php has and the same header.php required to it and it is not showing? EDIT It shows the username if placed outside of the sql statement. So obviously there is an issue with the code.
  11. I know I am doing it wrong but for the life of me can't figure out the correct way. Searched google etc and anything I find that is even close to it doesn't work. I am checking the username as was suggested on another website (can't even find that now lol) because I am trying to display information that the logged in user submitted and only display that specific information and not show that user information that was submitted by another user.
  12. Ok. Have done this. Still same result: <?php $check = isset($username); if($stmt = $link -> prepare("SELECT issue_id, driver_name, submit_date, fleet_number, issue_name, issue_description, issue_priority, issue_status FROM maintenance_requests WHERE username=?")) { $stmt->bind_param('s',$username); $stmt -> execute(); $stmt -> bind_result($issue_id, $driver_name, $submit_date, $fleet_number, $issue_name, $issue_description, $issue_priority, $issue_status); while($stmt->fetch()) { ?>
×
×
  • 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.