Koneksi Scan Barcode Dengan Php Mysql

Posted on by admin

We have been developing web application in php.
We need barcode scanner to be integrated into our application.

Mar 26, 2012  i want to pick up a barcode reader and have barcodes for each type of product so that when I (or someone else) takes one of the products, they can scan the barcode to update the inventory i know php. The server will be public. The terminal with the barcode reader will not.

Our application is divided into two modules, users and merchant.

When user comes and scans the card, merchant should be identified the user by barcode number. Admin will give barcode number and that is being sent to the card manufacturer and the number will be assigned to the magnetic stripe.

As i know scanner can acts as a key board, can you please tell the method to integrate barcode scanner into this php web based application?

user1035388user1035388

4 Answers

PHP can be easily utilized for reading bar codes printed on paper documents. Connecting manual barcode reader to the computer via USB significantly extends usability of PHP (or any other web programming language) into tasks involving document and product management, like finding a book records in the database or listing all bills for a particular customer.

Following sections briefly describe process of connecting and using manual bar code reader with PHP.

The usage of bar code scanners described in this article are in the same way applicable to any web programming language, such as ASP, Python or Perl. This article uses only PHP since all tests have been done with PHP applications.

Download the Ultraman - Fighting Evolution 0 (Japan) ROM for Playstation Portable. Filename: Ultraman - Fighting Evolution 0 (Japan) (v).zip. Ultraman fighting evolution rebirth iso.

What is a bar code reader (scanner)

Bar code reader is a hardware pluggable into computer that sends decoded bar code strings into computer. The trick is to know how to catch that received string. With PHP (and any other web programming language) the string will be placed into focused input HTML element in browser. Thus to catch received bar code string, following must be done:

just before reading the bar code, proper input element, such as INPUT TEXT FIELD must be focused (mouse cursor is inside of the input field).once focused, start reading the codewhen the code is recognized (bar code reader usually shortly beeps), it is send to the focused input field. By default, most of bar code readers will append extra special character to decoded bar code string called CRLF (ENTER). For example, if decoded bar code is '12345AB', then computer will receive '12345ABENTER'. Appended character ENTER (or CRLF) emulates pressing the key ENTER causing instant submission of the HTML form:

Choosing the right bar code scanner

When choosing bar code reader, one should consider what types of bar codes will be read with it. Some bar codes allow only numbers, others will not have checksum, some bar codes are difficult to print with inkjet printers, some barcode readers have narrow reading pane and cannot read for example barcodes with length over 10 cm. Most of barcode readers support common barcodes, such as EAN8, EAN13, CODE 39, Interleaved 2/5, Code 128 etc.

For office purposes, the most suitable barcodes seem to be those supporting full range of alphanumeric characters, which might be:

  • code 39 - supports 0-9, uppercased A-Z, and few special characters (dash, comma, space, $, /, +, %, *)
  • code 128 - supports 0-9, a-z, A-Z and other extended characters
Mysql

Other important things to note:

  • make sure all standard barcodes are supported, at least CODE39, CODE128, Interleaved25, EAN8, EAN13, PDF417, QRCODE.
  • use only standard USB plugin cables. RS232 interfaces are meant for industrial usage, rather than connecting to single PC.
  • the cable should be long enough, at least 1.5 m - the longer the better.
  • bar code reader plugged into computer should not require other power supply - it should power up simply by connecting to PC via USB.
  • if you also need to print bar code into generated PDF documents, you can use TCPDF open source library that supports most of common 2D bar codes.

Installing scanner drivers

Installing manual bar code reader requires installing drivers for your particular operating system and should be normally supplied with purchased bar code reader.

Once installed and ready, bar code reader turns on signal LED light. Reading the barcode starts with pressing button for reading.

Scanning the barcode - how does it work?

STEP 1 - Focused input field ready for receiving character stream from bar code scanner:

STEP 2 - Received barcode string from bar code scanner is immediatelly submitted for search into database, which creates nice 'automated' effect:

STEP 3 - Results returned after searching the database with submitted bar code:

Conclusion

It seems, that utilization of PHP (and actually any web programming language) for scanning the bar codes has been quite overlooked so far. However, with natural support of emulated keypress (ENTER/CRLF) it is very easy to automate collecting & processing recognized bar code strings via simple HTML (GUI) fomular.

The key is to understand, that recognized bar code string is instantly sent to the focused HTML element, such as INPUT text field with appended trailing character ASCII 13 (=ENTER/CRLF, configurable option), which instantly sends input text field with populated received barcode as a HTML formular to any other script for further processing.

Hope this helps you :)

Tahir YasinTahir Yasin

You can use AJAX for that. Whenever you scan a barcode, your scanner will act as if it is a keyboard typing into your input type='text' components. With JavaScript, capture the corresponding event, and send HTTP REQUEST and process responses accordingly.

Pablo Santa CruzPablo Santa Cruz

I've been using something like this. Just set up a simple HTML page with an textinput. Make sure that the textinput always has focus. When you scan a barcode with your barcode scanner you will receive the code and after that a 'enter'. Realy simple then; just capture the incoming keystrokes and when the 'enter' comes in you can use AJAX to handle your code.

Jesper VeldhuizenJesper Veldhuizen

If you have Bluetooth, Use twedge on windows and getblue app on android, they also have a few videos of it. It's made by TEC-IT. I've got it to work by setting the interface option to bluetooth server in TWedge and setting the output setting in getblue to Bluetooth client and selecting my computer from the Bluetooth devices list. Make sure your computer and phone is paired. Also to get the barcode as input set the action setting in TWedge to Keyboard Wedge. This will allow for you to first click the input text box on said form, then scan said product with your phone and wait a sec for the barcode number to be put into the text box. Using this method requires no php that doesn't already exist in your current form processing, just process the text box as usual and viola your phone scans bar codes, sends them to your pc via Bluetooth wirelessly, your computer inserts the barcode into whatever text field is selected in any application or website. Hope this helps.

Emphasis art ninth edition warhammer. This beautifully illustrated text reflects the latest trends in art education and demonstrates how to motivate students to learn by integrating art with other content.

Trey EllisTrey Ellis

protected by CommunityMay 25 '17 at 11:15

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged php or ask your own question.

I am trying to set up a library for books in my work place. I have the MySQL database set up, with the data and everything. Now what i am trying to do is have the ability for someone to take their phone, scan a QR code for a certain book, and it would check out the book. I have a field in the database that states if the book was checked out, and another stating check out date. How would i access my database externally through the internet and QR codes, and have the QR code change data in specific fields of my database, thanks. I used phpMyAdmin to set up the database, and my webhost is iPage.com.

Chris TeiChris Tei

Membuat Barcode Dengan Php

Membuat

2 Answers

As I already noted in a comment you question is simplar to the question Tranfer QR Code Into a MySql Database. But in your question are more points unclear: So far I did some research some guy from the support of iPage.com told me that php is supported by your webhoster in all packages.

So I will give your some hints how you can implement that with php:

For the database access use prepared statements and PDO. Here is a good tutorial about PDO.

For clean and simple urls for some kind of REST API use mod_rewrite with .htaccess:

Basically you have to check if mod rewrite is enabled. In your case you can skip this, but in general you have to check if you have a AllowOverride All statment in your directory directive.

Just put this code in your .htaccess file:

So you can access the qr code in yourphpfile.php with this simple variable access:

For the scanning part you can use the ZXing Barcode Scanner app:

If the user has the ZXing installed the brower will open the app automatically. If not the user will get a simple site which gives him or her a hint how to install the app.
You just have to link to the page the resulting value of the qr code will be submitted to the url http://example.com/seachbook/QR-code-content.

See also the full explanation on the ZXing documentation.

Community
rekirerekire

In general that certainly is possible. Actually every QRCode / barcode stores information. But usually the size of that information is pretty small. Typically only references like URLs or numbers (IDs) are stored and the 'real' data is retrieved from a database using those references. But strictly speaking that is a form of storing information in a QRCode / barcode.

Php

Looking closely we see that the data is stored in the code itself, not inside a database if we are talking about that small amount of data. Certainly that data can be stored inside a database when the code is read, all you need is a trivial piece of software. But that makes little sense in most cases, since the data already is stored. If you want to use a database to combine data from different sources, so if you only want to use codes as a means of transport, then reading the codes is just a replacement for typing the information in with a keyboard. So no magic here, nothing code specific you have to consider.

here is the php script to generate QR directly in db

Ricson JohnRicson John

Not the answer you're looking for? Browse other questions tagged mysqldatabasephpmyadminexternalqr-code or ask your own question.