This topic is locked
[SOLVED]

Multiple field values for QR Code

9/14/2021 7:12:14 AM
PHPRunner General questions
M
Mansour author

Hello
How i can make query by QR Code?

Example: i have record include the following field

  1. StudentNO
  2. StudentName
  3. StudentAge
  4. StudentGender

i make the student number type QR Code i need when the teacher scan the code all above information (Record) appears, is there any why to do that??

admin 9/14/2021

Modify your SQL query to concatenate all these fields together and setup this new calculated field as a QRCode.

If you use MySQL check concat() function

M
Mansour author 9/15/2021

this is not good solution bicouase it result will dispaly as a text

in the other hande if i want to display invoice and the inovice number view as QR Code when i scan this RQ Code i have to see invoice details (all record in the invoice)
how can i do that?

admin 9/15/2021

It is very confusing. So you do not need to encode the text as a QRCode? You can calculate the URL of the View page of this invoice, display it as QRCode and when someone scans it they will be taken to that View page.

M
Mansour author 9/16/2021

Yes this is solution may be work, but how to let the RQ Code mention to link?

A
acpan 9/16/2021

From what @admin tried to suggest and what i think:

  1. record the url of the view page that shows the student data you want the teacher to see, each url has a parameter that contains the record id.


  2. put the url as data for the QRCode field which includes the record id. (i am not at my desktop, so this part i am not too sure how you can insert the dynamic record id, if it does not allow, then you meed to use custom code to generate the QRCode instead of PHPR's built in QRCode).



Generate the project and scan the QRCode, it will take you to the view page of the student data.

Note: you need to ensure security check at Before Display event of the view page, if it is a public page without login.

M
Mansour author 9/19/2021

Dera acpan,

Thank you for your help, I think your solution will work good but i need the system generate this dynamicly
becuse system's user does not have good knoldeg to do that also this will take more time in the work with propapilty of mistake
agin many thanks for your kindness help

A
acpan 9/19/2021

It should work out of the box on PHPR.

  1. Just form an extra field eg. QRCode_URL in your student list page:

In your PHPR's SQL Editor:

SELECT student_id, field1, field2, field3, CONCAT("https://xyz.com/whatever/student_view.php?edit1=", student_id, "&hash=", hash_value) AS QRCode_URL FROM student_table

Where hash_value can be any "randomly generated" value stored or derived form the the student's data in DB.

  1. Then go to Visual Editor and set View As for the QRCode_URL to QRCode Type.


  2. Generate the project.



Then go to List page and scan the list QR Codes and see if it takes you individually to the Students' View pages.

I notice your question's objective has been changing along the way, it indicates that you have not tried anything nor understand how basic QRCode works in PHPR. So no point saying what if this and that, without knowing how. Try first without hash check and see if it takes you to the page.

A
acpan 9/19/2021

If you are interested to implement some security check later, here's some idea:

When QRCode is scanned, it takes the viewer to the Student's view page which look like this:

You can implement some check: At the view page's Before Processed Event with the URL param passed.

// exit immediately if no hash is passed
$hash = isset($_REQUEST["hash"]) ? $_REQUEST["hash"] : -1;
if ( $hash = -1 ) { echo "Hash error!"; exit(); }

// check against DB if hash is passed
$encoded_hash = your_encode_function ($data["student_id"].$data["student_hash"] )
if ( $hash != $encoded_hash ) {
echo "Hash error!";
exit();
}

Where student_hash is a hash value created during student record creation.

Above approach is for viewer with a login account, your_encode_function can be any encoding function, or simply use PHPRunner's built-in generatePassword() function.

Update: Found out later that there is also an example about how to allow public access to view page using hash value. refer to this blog here

M
Mansour author 9/19/2021

Thank you for your help again

about your question "I notice your question's objective has been changing along the way, it indicates that you have not tried anything nor understand how basic QRCode works in PHPR. So no point saying what if this and that, without knowing how. Try first without hash check and see if it takes you to the page."

my question's objective has changed along the way becuase i am new start learning the QR Code and i dont have good knowledg .

Thank you

A
acpan 9/19/2021

No worries, this is my way of telling people, don't hesitate, try it and you will find the rope along the way, we all have gone through that too :) It will be easier to advise once you are onto it.

M
Mansour author 9/21/2021

Dear Acpan thank you i appreciate your kindness help i am realy got a benift from your advise