0
how to store data from qrcode to database?
Can someone please help me? I am having a hard time on how can I store data in the database from qrcode? I mean once the qrcode is scanned the data will automatically store into the database.
6 Réponses
0
<div class="col-sm-6">
<form action="index.php" method="POST">
<div class="thumbnail" id="result">
<div class="caption">
<h2>Scanned result</h2>
<p id="scanned-QR"></p>
</div>
</form>
<div>
<img width="320" height="240" id="scanned-img" src="">
</div>
</div>
<div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="js/filereader.js"></script>
<script type="text/javascript" src="js/qrcodelib.js"></script>
<script type="text/javascript" src="js/webcodecamjs.js"></script>
<script type="text/javascript" src="js/main.js"></script>
<?php
if(isset($_POST['scanned-QR']))
{
error_reporting(E_ALL^E_NOTICE);
$student_no==0;
$res=mysqli_query($conn,"select * from qrcodes where student_no='$_POST[qrStud_no]'");
while ($row=mysqli_fetch_array($res))
{
$student_no=$row["student_no"];
}
if ($student_no==0)
{
?>
echo "hello";
<?php
}
else{
mysqli_query($conn,"insert into qrlogin values('','$_POST[date]','$_POST[firstname]','$_POST[lastname]','$_POST[student_no]','$_POST[time_in]','$_POST[time_out]')");
?>
echo "world";
<?php
}
}
?>
0
This is not the full code
0
<body>
<div class="container" id="QR-Code">
<div class="panel panel-info">
<div class="panel-heading">
<div>
<h1>Occ</h1>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-sm-6">
<div class="well" style="position: relative;display: inline-block;">
<canvas width="320" height="240" id="webcodecam-canvas"></canvas>
<div class="scanner-laser laser-rightBottom" style="opacity: 0.5;"></div>
<div class="scanner-laser laser-rightTop" style="opacity: 0.5;"></div>
<div class="scanner-laser laser-leftBottom" style="opacity: 0.5;"></div>
<div class="scanner-laser laser-leftTop" style="opacity: 0.5;"></div>
</div>
<div class="navbar-form navbar-right">
<select class="form-control" id="camera-select"></select>
0
<div class="form-group">
<input id="image-url" type="text" class="form-control" placeholder="Image url">
<br>
<button title="Decode Image" class="btn btn-default btn-sm" id="decode-img" type="button" data-toggle="tooltip"><span class="glyphicon glyphicon-upload"></span></button>
<button title="Image shoot" class="btn btn-info btn-sm disabled" id="grab-img" type="button" data-toggle="tooltip"><span class="glyphicon glyphicon-picture"></span></button>
<button title="Play" class="btn btn-success btn-sm" id="play" type="button" data-toggle="tooltip"><span class="glyphicon glyphicon-play"></span></button>
<button title="Pause" class="btn btn-warning btn-sm" id="pause" type="button" data-toggle="tooltip"><span class="glyphicon glyphicon-pause"></span></button><button title="Stop streams" class="btn btn-danger btn-sm"
0
id="stop" type="button" data-toggle="tooltip"><span class="glyphicon glyphicon-stop"></span></button>
</div>
</div>
</div>
<div class="col-sm-6">
<form action="index.php" method="POST">
<div class="thumbnail" id="result">
<div class="caption">
<h2>Scanned result</h2>
<p id="scanned-QR"></p>
</div>
</form>
<div>
<img width="320" height="240" id="scanned-img" src="">
</div>
</div>
<div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="js/filereader.js"></script>
<script type="text/javascript" src="js/qrcodelib.js"></script>
<script type="text/javascript" src="js/webcodecamjs.js"></script>
<script type="text/javascript" src="js/main.js"></script>
0
that may be