How to get data from MySQL database with PHP and put it in an HTML table – Code Explained

Here’s the php code I used to output from my database. You’ll need to put in the proper connections to change everything over to work for your app.

<table class="table table-striped table-responsive-md btn-table">
<!-- -->
  <thead>
    <tr>


      <th>Username</th>
      <th>Current Game</th>
      <th>In-Game Username</th>
      <th>Looking for</th>
      <th>Reputation Score</th>
      <th>Contact via</th>
    </tr>
  </thead>
<!-- -->
  <tbody>
    <!-- -->
    <tr>

      <?php
      $servername = "localhost";
      $username = "root";
      $password = "";
      $dbname = "gamerapp";

      // Create connection
      $conn = new mysqli($servername, $username, $password, $dbname);
      // Check connection
      if ($conn->connect_error) {
          die("Connection failed: " . $conn->connect_error);
      }

      $sql = "SELECT username FROM userdata";
      $result = $conn->query($sql);

      if ($result->num_rows > 0) {
          // output data of each row
          while($row = $result->fetch_assoc()) {
              echo "<tr><td> " . $row["username"]. "</td></tr>";
          }
      } else {
          echo "0 results";
      }
      $conn->close();
      ?>
  </tbody>

</table>

How to make a signup form in PHP that posts data to MYSQLI database – Code Explained

Here’s the code for “firststepssignup.php”

<form action="insertfirstinfo.php" method="POST" role="form">

  <div class="form-group">

    <div class="text-center">
      <h1 class="display-4 p-2" >Signup</h1>
    </div>

    <!-- here is where the first and last name are collected and sent to the database -->

    <div class="form-group">
      <div class="row">
        <!-- here is where the first and last name are collected and sent to the database -->

        <div class="col">
          <label for="firstname">First Name </label>
          <input id="first_name" name="first_name" type="text" class="form-control" placeholder="First name" required>
        </div>

        <div class="col">
          <label for="lastname">Last Name </label>
          <input id="lastname" name="lastname" type="text" class="form-control" placeholder="Last name">
        </div>
      </div>
    </div>

    <div class="form-group">
      <!-- here's where the email address is collected and sent to the database -->
      <label for="email">Email address</label>

      <input id="email" name="email" type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">

    </div>

    <div class="form-group">
        <!-- here is where the username is collected and sent to the datbase -->
      <label for="username">Username</label>

      <input id="username" name="username" type="username" class="form-control" id="usernameInput" placeholder="Username">

    </div>

    <div class="form-group">
        <!-- -->
      <label for="password">Password</label>

      <input id="password" name="password" type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">

    </div>
    <!-- -->

  <button href="index.php" type="submit" value="submit" class="btn btn-primary btn-block">
    <a style="color: white;" href="index.php">Next</a>
  </button>

</form>

Here’s the code for the action of the form in “firststepssignup.php”

YOU WILL NEED TO HAVE AN INDEX.PHP FILE THAT BRINGS THIS ALL TOGETHER AND INCLUDES BOOTSTRAP OR THIS CODE WILL LOOK HORRIBLE.

Here’s “insertfirstinfo.php”

<?php
/* Attempt MySQL server connection. Assuming you are running MySQL
server with default setting (user 'root' with no password) */
$link = mysqli_connect("localhost", "root", "", "gamerapp");

// Check connection
if($link === false){
    die("ERROR: Could not connect. " . mysqli_connect_error());
}

// Escape user inputs for security
$first_name = mysqli_real_escape_string($link, $_REQUEST['first_name']);
$lastname = mysqli_real_escape_string($link, $_REQUEST['lastname']);
$email = mysqli_real_escape_string($link, $_REQUEST['email']);
$password = mysqli_real_escape_string($link, $_REQUEST['password']);
$username = mysqli_real_escape_string($link, $_REQUEST['username']);


// Attempt insert query execution
$sql = "INSERT INTO userdata (first_name, lastname, email, password, username) VALUES ('$first_name', '$lastname', '$email', '$password', '$username')";
if(mysqli_query($link, $sql)){
    echo "Records added successfully.";
    header('location: index.php');
} else{
    echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}

// Close connection
mysqli_close($link);
?>

How to Win the BuyBox on Amazon – 2016 eCommerce Tips

Winning the BuyBox is essential to gaining great success on Amazon. There are a number of factors you need to focus on, but I’ll break down the essentials in the video below and in this post here.

  1. Be competitive on pricing.
  2. Make sure you maintain seller performance standards (click link for metrics)
  3. Make sure you are fulfilling items as quickly as possible (use Amazon FBA)
  4. Have more inventory than your competition.

If you strive to do the best that you can in these 4 areas, you won’t go wrong and you will win more and more buy boxes over time. On high competition items, you can expect less and less sales the further down the “see more sellers” list you are. Getting to the top means providing great service to your customers, getting better deals and playing by Amazon’s rules.

 

If you like what I’ve talked about here, pick up my free ebook, or my training program.

How to Price Your Items & Get More Online Sales – 2016 eCommerce Tips

Pricing your items is all about measuring your true cost against the market value of your items. When you’re figuring out what to price your items for, you have to keep all costs in mind. All of your costs means fees, taxes, shipping, item cost, labor and advertising. If you’re calculating things wrong, you could very easily be making no money at all! Make sure you cover these things when you are thinking about how to price your items, and always try to stay very competitive when you’re selling items so you can sell more than your competition!

 

Why Live Chat Is Essential for Your Online Store – 2016 eCommerce Tips

Live chat is a simple and profitable addition to your eCommerce store, or any website for that matter, that will bring MASSIVE value to your customers. Here’s why… it simply brings you and your customers one step closer to letting you into their wallet. Customers need information, and instead of making them search high and low for your contact link so that they can wonder when they’ll get an email reply, why not let them know exactly when you’re available and give them access right then.

Next Level Retail: A Practical Guide to Selling Online

Lots of brick and mortar store owners want to get their business online, but just don’t know where to start. In this book, i’ll give you the keys to a solid foundation when it comes to selling online.

The tips I give you in this book will allow you to scale your business to whatever size you want to go without restrictions. These concepts are proven and tested through years of my own work helping retail stores sell online.

How we took an extreme sports retailer to the next level…

One of our most recent and exiting projects involved taking a small snowmobile riding clinic/gear shop from a Shopify only store to a wider internet market, setting them up on eBay and Amazon.

This store sells riding gear, as well as snowmobile parts & decals.

The first step we took was lining up their SKUs on Ebay & Amazon.

Inside ebay you’ll see this as the second field down. This needed to match their Amazon & Shopify store for everything to sync.

case234

 

We made the SKU something easy for the picker to identify the product with when sending it, in most cases we used the UPC, but often made a code in a structure of “Brand” + “Model” + “Color” + “Size” which is a really good strategy to run on when building SKUs.

amazonskuscase1

If you can, keep everything on a noticeable format so you can easily find products in your inventory, having skus that look like “98hhr-jhwegrer746” can make things crazy! We used manufacturer part numbers when possible, and UPC codes whenever we couldn’t find it or it didn’t exist.

 

Along the way, we had to submit an application to be approved in the Amazon Automotive & Powersports category, which was a short and easy process that we were able to help them navigate through.

amazoncategoryungating

Amazon wants to make sure you are legit, and that you won’t sell counterfeit items on their marketplace. They also won’t let you in without at least a few product listings. This can be tricky and at some times slower than other times. In this case approval only took a few days!

 

Once we were approved, we were able to start listing some products in that category, which was not without some challenges.

One issue was that some of the products they needed to list had never been on Amazon before, and the images from the manufacturer were not Amazon compliant, so we had to make them compliant with some quick photo editing.

amazoncompliant1

 

The next challenge that came was that some of the image pictures were incorrect, and the worst we found was where another seller had put their name onto the photo images, and uploaded it to try and “grab” some extra advertising. This is very much against Amazon’s listing policies and makes all the other sellers look terrible.

casestudy1

After submitting a case to Amazon, they changed the images over to the ones that we submitted, getting rid of the text and duplicate images, creating a clean and professional look.

casefan1

All in all, this company will be able to plug up an inventory sync system for it’s Ebay, Shopify & Amazon channels and start selling on a much wider online market.

 

 

 

 

How to get your physical retail business online

Ok, so you’re a small business owner and you own a physical retail store. People come in during business hours, they browse, they buy. It works, but what if you could do more?

What if I told you that with a very minimal investment you could reach hundreds of thousands of new customers, let them browse your catalog 24/7 and increase your sales by 100% or way more all within your existing store space. Every item in your store can be listed easily, all you have to do is put it up for sale, and keep track of how many their are.

It’s simple. Here’s what you need to know.

  1. You need an digital inventory system. Knowing where things are and how many you have is essential to being online. You may get away with it on paper, but you won’t trying to sell online. You’ll have to find the one that fits but a great solution I’ve worked with is Skuvault. It lets you keep track of where things are at, and even pushed your numbers up to eBay and Amazon.
  2. You’ll need an Amazon seller account, and an eBay account.

Once you get these accounts setup, you can go through your store item by item, log the quantity, and list the item with a price and some details, and you’re up and running already! You inventory system will sync the numbers out, and when things sell, just grab them from your store’s inventory location and ship them out.

It sounds easy, and you can be, but there are a ton of more advanced aspects to selling online, this starts you out at a basic level where you will see results easily. Don’t get discouraged if you don’t see results after listings 2-10 items. List your whole catalog. If you are a storefront with 200-1000 individual items you will see massive results.

This strategy will allow you to see immediate results without running into overselling issues.

If you want to get online, but don’t want to do the work yourself or need consulting assistance to get started, reach out to us!

supplementshelves

Harmonifi, a solution for cell phone radiation

One of our current projects is for a cell phone safety solution called Harmonifi.

Harmonifi attaches to any mobile device easily, and helps combat the effects of cell phone radiation.

We started building the company social media accounts by posting relevant content and creating media that individual followers could interact with.

 

On Harmonifi’s pinterest page, we created a posting structure that gave value to their followers by not only posting about the benefits of their product, but also by giving tips, how-to’s and links to smartphone related topics in general.

harmonifipinterest

 

On their Twitter page, we created a consistent posting schedule with lots of hashtags to build follower interaction.harmonifitwitter

 

We also created some designs to help build user interaction and “shareability”.

harmonifiad1 harmonifiad2 harmonifiad3

 

Our Instagram efforts involved interacting with people who like and follow companies that sell cell phone accessories, and also, people who have blogs.

harmonifiinstagram

 

We hope to see the continued effects of our efforts with Harmonifi’s social accounts, which have gone nowhere but up!

 

Check out our other client stories in the coming weeks and reviews on the rest of our blog.

 

A theme for events & seminars… “Eventim” WordPress theme review

So recently I stumbled up what I think is a really great theme for any sort of seminar, workshop, or corporate event.

If you’re planning something that you want to be a “big deal”, you should really invest in a webpage for it. There’s no reason not to.

Grab a domain, or add a subdomain onto your company site, and slap this theme on there for $59. It will be a superb investment for your event as a whole, and I’ll tell you a bit about why in just a second.

So Eventim is flawlessly mobile responsive, so anybody can get info on your event easily from any device. It is easily updated and modified inside of WordPress, so you can change details on the fly easily, from any device.

With this theme you can…

  • Showcase all of your speakers and provide bios on all of them
  • Provide a list of event & speaker times
  • Sell tickets and merchandise (this is a big plus)
  • Give a gallery of video & pictures in an attractive format
  • Show an active countdown clock that helps build anticipation
  • Showcase your sponsors (if you have any)
  • Provide an FAQ section

Overall the styling is great, I don’t have any notable complaints about functionality, and I think if you use this theme as it was intended you’ll find great value in it.

Do check out the video review below where I cover a bit more on what I think about the Eventim theme, and click here to view the demos for yourself.