[SOLVED] Â Add/Edit Page > Before Record Added > QR Code |
5/6/2016 7:50:27 PM |
PHPRunner General questions | |
M
mmaner author
I dont understand why this doesnt work. I am using this function on the Add/Edit Page > Before Record Added. Any help would be greatly appreciated. thanks $values["barcode_value"] = $values["https://chart.googleapis.com/chart?cht=qr&chs=150x150&chl=http://10.1.1.1/phprnrapp_view.php?editid1="].$values[`id'>https://chart.googleapis.com/chart?cht=qr&chs=150x150&chl=http://10.1.1.1/phprnrapp_view.php?editid1="].$values[`id`]; |
|
![]() |
Sergey Kornilov admin 5/9/2016 |
$values is an array that stores values of individual fields. You need to use it the following way: $values["FieldName"]
|
M
|
mmaner author 5/9/2016 |
$values is an array that stores values of individual fields. You need to use it the following way: $values["FieldName"]
UPDATE `DBTable` SET `barcodevalue` = CONCAT("https://chart.googleapis.com/chart?cht=qr&chs=150x150&chl=http://10.1.1.1/phprnrapp_view.php?editid1=",`id`) |
![]() |
Sergey Kornilov admin 5/9/2016 |
Is 'id' is your key column or just a regular field? |
M
|
mmaner author 5/9/2016 |
Is 'id' is your key column or just a regular field?
|
![]() |
Sergey Kornilov admin 5/9/2016 |
The problem with key column that its value doesn't exist before record is physically created in the database. In BeforeAdd event the record in question doesn't exist yet. CustomQuery("UPDATE `DBTable` SET `barcodevalue` = CONCAT("https://chart.googleapis.com/chart?cht=qr&chs=150x150&chl=http://10.1.1.1/phprnrapp_view.php?editid1=",`id`)"); |
M
|
mmaner author 5/10/2016 |
The problem with key column that its value doesn't exist before record is physically created in the database. In BeforeAdd event the record in question doesn't exist yet. What you can do is to run the same SQL code in AfterAdd event: CustomQuery("UPDATE `DBTable` SET `barcodevalue` = CONCAT("https://chart.googleapis.com/chart?cht=qr&chs=150x150&chl=http://10.1.1.1/phprnrapp_view.php?editid1=",`id`)");
|
M
|
mmaner author 5/10/2016 |
Makes sense, can't believe I didnt think about that. thanks
syntax error, unexpected 'https' (T_STRING) in line 1
|
M
|
mmaner author 5/10/2016 |
In case anyone else runs into this issue I figured it out. You have to addslashes to define that the backslashes in the URL is not a comment. CustomQuery("UPDATE `DBTable` SET `barcodevalue` = CONCAT(\"https://chart.googleapis.com/chart?cht=qr&chs=150x150&chl=http://10.1.1.1/phprnrapp_view.php?editid1=\",`id'>https://chart.googleapis.com/chart?cht=qr&chs=150x150&chl=http://10.1.1.1/phprnrapp_view.php?editid1=\",`id`)"); |