1

I want to save the image or the value of the QR code/decodedText variable into My SQL database using PHP. Here is the code:

 <div class="container" style="padding-left: 25%;"> 
  <div class="row"> 
   <div id="qr-reader" style="width: 600px"></div> 
  </div> 
 </div>

And the JavaScript

    <script> 
     function onScanSuccess(decodedText, decodedResult) { 
     console.log(`Code scanned = ${decodedText}`, decodedResult); 
     } 
   var html5QrcodeScanner = new Html5QrcodeScanner( "qr-reader", { 
     fps: 10, qrbox: 250 }); 
     html5QrcodeScanner.render(onScanSuccess); 
    </script>
    <script src="https://unpkg.com/[email protected]/dist/html5-qrcode.min.js"></script>

1 Answer 1

1

Use fetch and formData

fetch("file.php", method:"POST", data: formData)

then in php you connect with mysql

$conn = new mysqli("localhost", "root", "", "db");
$conn->query("ISERT INTO .....")
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.