BEST HOME INVENTORY MANAGEMENT SOFTWARE FREE AND EASY

Functions

OK since I included functions.php on the previous page, then we will discuss it here.  Notice I included the config file here. That is my connection to the database. I wanted to use pagination on the details page so I created a function to get the next and previous page.

<?php 
include_once('config.php');

function getnextid($var){
  global $con;
  global $uid;
  $result = $con->query("SELECT user, id FROM merch WHERE user='$uid' AND id>'$var' ORDER BY id ASC") ;
  $total=$result->num_rows;
  if($total>0){
  while ($row = $result->fetch_assoc()) {
  $usernextitem= $row['id'];
  }
  }else{
    $usernextitem=0;
  }
  return $usernextitem;
}

function getprevid($var){
  global $con;
  global $uid;
  $result = $con->query("SELECT user, id FROM merch WHERE user='$uid' AND id<'$var' ORDER BY id ASC") ;
  $total=$result->num_rows;
  if($total>0){
  while ($row = $result->fetch_assoc()) {
  $usernextitem= $row['id'];
  }
  }else{
    $usernextitem=0;
  }
  return $usernextitem;
}
?>

Footer

In the footer I wanted to see if we set a session. If so, I wanted to show a different menu for logged in users and logged out users. I handle this with CSS and PHP.

<?php
    if (isset($_SESSION['id'])) {
    echo '<style> 
    #hidee{display:none;}
    #show{display:block;}
    </style>';
    }else{
    echo '<style> 
    #hidee{display:block;}
    #show{display:none;}
    </style>';
  }
 ?>
</div>
</body>
</html>

Menu

Of course I am using bootstrap because it’s outstanding for mobile and desktops. However, notice the class names of hidee and show. If you look at the footer.php script above you will see that we are hiding menu items for logged in and logged out users.

<nav class="navbar navbar-default">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="index.php"><?php echo $name; ?></a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li><a href="index.php">Home <span class="sr-only">(current)</span></a></li>
        <li><a href="login.php" id="hidee">Log In</a></li>
    <li><a href="signup.php" id="hidee">Signup</a></li>
    <li><a href="inventory.php" id="show">Inventory</a></li>
    <li><a href="enterinventory.php" id="show">Enter Inventory</a></li>
        <li id="hidee"><a href="lostpass.php">Lost Password</a></li>
        <li id="show"><a href="logout.php">Log Out</a></li>
      </ul>
      <form class="navbar-form navbar-right" method="post" action="search.php">
        <div class="form-group">
          <input type="text" name="search" class="form-control" placeholder="Search">
        </div>
        <button type="submit" class="btn btn-default">Submit</button>
      </form>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>

Only cool people share!

BEST HOME INVENTORY MANAGEMENT SOFTWARE FREE AND EASY was last modified: July 27th, 2022 by Maximus Mccullough
BEST HOME INVENTORY MANAGEMENT SOFTWARE FREE AND EASY

Pages:Previous 1 2 3 4 Next

8 Comments

  • Morten Nordby says:

    Hey, very nice app. I can see that your online version is updated a lot since the first version. Is there any chance of getting do download the updated php files for the updates you have done to the inventory app?

  • Hi Maximus, i have been thinking about this app for the last week, and i have several improvements i would like to propose to you for this app. But i would really like to get my hand on the source files for your latest updated version of the app before i can start suggesting new functions and so on. And i would really like to be able to do some testing on my local installation before i send you any suggestions. So as you can see i am waiting to get my local installation upgraded to your latest version to be able to go forward with using and sending you questions about new features and so on 🙂 I hope i may get my hands on the latest source files sooner than later to be able to move forward 🙂 Kind regards, Morten

  • Andrew says:

    I added a category field in the merch table and I believe I have edited all of the relevant files to take that field into consideration. Have you thought about adding a category field to the online application?

  • Andrew says:

    OK, I see…the online application is set up so that you can enter a location or category in the location field. I just entered a separate field for the category so that there is a location and category field. As for the tags, I have to read up some more about them, as I am not sure how they really work.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.