Hi
Simple version: is possible to use the $conn variable in a custom php page? How to use it? A code like the one below could work?
<?php
if(!defined('custom_page_from_inclusion')) { die(); }
global $conn;
$sql = "INSERT INTO Interessati (Interessati) VALUES ('Clienti')";
if(mysqli_query($conn, $sql)){
echo "Records inserted successfully.";
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($conn);
}
?>
Long version: I have a form for table A with a multiple select field that lockup to a related table B (Many to Many relationship).
In some circumstances, I need to let users to add new values in the related table B while they are in the form of table A, but I understand that this is not possible. So I create a new field in form A that ask "Do you need to insert a new value?". If the answer is "Yes", a JS custom function open a custom PHP page with a simple form to let user to insert just the new value and return to the original form.
Now I'm trying to insert the new value with a SQL query inside the custom PHP page (recalled by the custom JS function) but it seems that the database connection doesn't work...
Thanks in advance
My system info are:
You are using DaDaBIK version 9.0-Monterosso enterprise, installed on 16-08-2018 (installation code: 0), the latest version of DaDaBIK is 9.0-Monterosso released on 05-07-2018
You are runnning the last release of DaDaBIK
PHP Version: 7.2.7
mysql version: 5.7.21
Web server: Apache/2.2.34 (Unix) mod_wsgi/3.5 Python/2.7.13 PHP/7.2.7 mod_ssl/2.2.34 OpenSSL/1.0.2o DAV/2 mod_fastcgi/mod_fastcgi-SNAP-0910052141 mod_perl/2.0.9 Perl/v5.24.0
Client: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15
Simple version: is possible to use the $conn variable in a custom php page? How to use it? A code like the one below could work?
<?php
if(!defined('custom_page_from_inclusion')) { die(); }
global $conn;
$sql = "INSERT INTO Interessati (Interessati) VALUES ('Clienti')";
if(mysqli_query($conn, $sql)){
echo "Records inserted successfully.";
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($conn);
}
?>
Long version: I have a form for table A with a multiple select field that lockup to a related table B (Many to Many relationship).
In some circumstances, I need to let users to add new values in the related table B while they are in the form of table A, but I understand that this is not possible. So I create a new field in form A that ask "Do you need to insert a new value?". If the answer is "Yes", a JS custom function open a custom PHP page with a simple form to let user to insert just the new value and return to the original form.
Now I'm trying to insert the new value with a SQL query inside the custom PHP page (recalled by the custom JS function) but it seems that the database connection doesn't work...
Thanks in advance
My system info are:
You are using DaDaBIK version 9.0-Monterosso enterprise, installed on 16-08-2018 (installation code: 0), the latest version of DaDaBIK is 9.0-Monterosso released on 05-07-2018
You are runnning the last release of DaDaBIK
PHP Version: 7.2.7
mysql version: 5.7.21
Web server: Apache/2.2.34 (Unix) mod_wsgi/3.5 Python/2.7.13 PHP/7.2.7 mod_ssl/2.2.34 OpenSSL/1.0.2o DAV/2 mod_fastcgi/mod_fastcgi-SNAP-0910052141 mod_perl/2.0.9 Perl/v5.24.0
Client: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15