Bootstrap Barcode Scanner Generator

In this tutorial, i will show you the Barcode Scanner Generator using bootstrap design. The PHP Barcode Scanner Generator is a server-side script that adds barcode generation and scanning the item inside the database and capability to any PHP-compatible website.

Sample Code

Script for checking the generated barcode.
  1. <?php
  2.         include_once('dbconnect.php');
  3.         if(empty($_POST['scaninput']) == FALSE)
  4.         {
  5.         $barcode = htmlentities($_POST['scaninput']);
  6.                 $barcode_check = $con->query("select * from barcode where barcode='$barcode'");
  7.                 if($barcode_check->rowCount() > 0)
  8.                 {
  9.                         while($row = $barcode_check->fetch(PDO::FETCH_OBJ))
  10.                         {
  11.                                 $status = $row->status;
  12.                         }
  13.                 }
  14.                 if($barcode_check->rowCount() > 0 && $status == 'Valid')
  15.                 {
  16.                         $sell = $con->exec("UPDATE barcode SET status='Invalid' where barcode= '$barcode'");
  17.                         if($sell > 0)
  18.                         {
  19.                                 echo "<script> alert('Successfully sold');</script>";
  20.                         }
  21.                 }else if($barcode_check->rowCount() > 0 && $status == 'Invalid'){
  22.                         echo "<script> alert('Item Not Sold');</script>";
  23.                 }else{
  24.                 echo "<script> alert('Item Not Present....');</script>";
  25.                 }
  26.         }else{
  27.                 echo "<script> alert('Please Input or Scan Barcode.....');</script>";
  28.         }
  29. ?>
Result Only commonly used parameters are included in the script generator files, ensuring quick and efficient PHP barcode scanning generation. Hope you like it. Enjoy Coding!

Add new comment