-4

guys. Can somebody please help how to do that script goes through MySQL database every row and creates specific QR code to every row and stores that in database?

I am creating small online store and I would like to have QR code next to items. Here are good example how I would like to get things done: http://www.basethings.com/p4030/Anti-Doze-Off-Device-For-Drivers/product_info.html

Any help is more than welcome.

Renalds
  • 9
  • 2
  • 4
  • http://stackoverflow.com/questions/16022496/how-to-generate-barcode-using-php-and-display-it-as-an-image-on-the-same-page – Alexey Palamar May 03 '14 at 21:34
  • What have you *tried*? – Casey Dwayne May 03 '14 at 21:34
  • @kcdwayne I have database called ''store'', which includes table with fields: ID, Name, Description, Image(BLOB type) For creating QR codes, I tried to use PHP QR Code Library (http://phpqrcode.sourceforge.net/) Before I asked this question, I tried to manually create QR code with PHP QR Code Library and insert it in my Database and then display. I used this tutorial how to do that and it worked: http://installationquery.blogspot.com/2012/05/inserting-and-displaying-images-from.html Maybe that will help somebody. So, really looking forward for some help here and huge thanks in advance. – Renalds May 03 '14 at 21:36
  • 2
    You asked about that an hour ago already, http://stackoverflow.com/questions/23449332/qr-codes-generation-from-mysql-rows – and that question had more detail, so what is the point of creating a duplicate with _less_ info now? – CBroe May 03 '14 at 21:39
  • @CBroe Yes, maybe you can take a look at that question and try to help resolve it? I am sorry if I made confusion to you with creating this question. I simply couldn't find/get solution. – Renalds May 03 '14 at 21:41
  • 1
    Really, you should include code samples/previous attempts with your question. This isn't a *code for me free* site. – Casey Dwayne May 03 '14 at 21:41
  • @Renalds: Please refrain from creating duplicates in the future – instead, think about what you could possibly do to improve your original question (by editing it), if the question quality might be the reason you get no answers. And in general: Show some more _patience_ – _one hour_ is not a sufficient time frame, it might take longer for someone who knows how to handle your problem to stumble upon it. So at least give it a day or so … – CBroe May 03 '14 at 21:44
  • Thank you for replies, I really appreciate that. I hope somebody know solution to this frustrating problem. Thank you, guys. – Renalds May 03 '14 at 21:53

1 Answers1

0

Set up a PHP function to read, create, and store your items as a QR image. There are open source generators out there you can use, like this one: http://phpqrcode.sourceforge.net/

Edit: If you're really new at PHP/Databases, you'll also need to look into PDO and at the very least, foreach or while loops to automate the process. If you're new to SQL, that too. It's hard to gauge what you do and do not know about programming since you didn't provide any code.

Edit #2: This question contains code like I would have expected to see with your question. It should give you a basic idea of the format.

To paraphrase that question for your purposes:

function getContent() {
    $db = PDOconn();
    $query = "SELECT * FROM yourtable";
    $sql = $db->prepare($query);
    $sql->execute();
    $row = $sql->fetchAll();
    return $row;
}

function setQR($id,$code) {
  $db = PDOconn();
  $query = "UPDATE yourtable SET qr WHERE id=:$id";
  $sql = $db->prepare($query);
  $sql->execute();
  echo "QR created for item $id <br> \n";
}

$data = getContent(); //you're storing the DB array

foreach($data as $row)
    $id = $row['ID'];
    //your URL or whatever to be a QR
    $content = $row['Column'];
    //create QR using generator
    $code = insert_code_here($content);
    //add the new row to the database
    setQR($id,$code); #similar to 1st function, but setting and passing parameters
}
Community
  • 1
  • 1
Casey Dwayne
  • 2,142
  • 1
  • 17
  • 32
  • Thank you for response. Yes, I tried to use that QR Code library, I managed to get it working manually (create manually QR code and insert it in database and then display by ID). What I need to do next is to create script, which goes through every row record, what I have in MySQL and create QR code to every row. Do you know how to do that? I am not powerful with coding, sorry. Also, could you take a look here, please, maybe it will help to you, I explained more there: http://stackoverflow.com/questions/23449332/qr-codes-generation-from-mysql-rows – Renalds May 03 '14 at 21:43
  • Thanks. What I wanted to know, if you can help to create script, which goes through every MySQL row and creates QR code for every row and stores in database? – Renalds May 03 '14 at 21:47
  • @Renalds Have you tried writing this? If so, can you post the code you've tried? Stack Overflow isn't a _write this code for free_ site. – vvanasten May 03 '14 at 21:53
  • @kcdwayne thank you for code, I will try it and try more, see how all end out. Thanks. – Renalds May 03 '14 at 22:10
  • @wanasten I will try. Yes, my apologies. If I couldn't do that, I could offer money to do that.. but I will try my best. Thanks, guys. You are the best. – Renalds May 03 '14 at 22:12