install errors 10.3-Manarola pro

Current PHP version: 7.4.11 OK
mbsgtring extension: Installed
ioncube extension: Installed
ioncube extension version: 10.4 OK
Check DB connection: OK
mysql version: 8.0.22 OK
Apache 2.4.46

I invoke localhost/dadabik/install.php
I choose "Build a new application based on the database firearms (this is the classic way)" ("firearms" is an existing schema with six tables)

Next page shows that the following will be sent to you:
your serial number
installation URL = http://localhost/dadabik/
dbms_type = mysql
installation_type (db, blank, csv, xml, ods or prepackaged)
dadabik_version = 10.3-Manarola pro
os = Windows NT ---------------------------------------------- this win10
php_version = 7.4.11
date_time = 2020-10-23 01:01:42

I accept license and privacy policy, click "INSTALL" button

Next page, I get these errors:

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 821

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 821

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 822

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 822

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 821

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 821

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 822

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 822

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 821

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 821

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 822

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 822

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 821

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 821

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 822

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 822

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 821

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 821

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 822

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 822
On-line registration done......your installation code is: 160885f9264c578e05


Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 821

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 821

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 822

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 822

Fatal error: Maximum execution time of 120 seconds exceeded in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 186


Each time I get a different "installation code".

How can I get past these errors? What other info can I provide?
 

eugenio

Administrator
Staff member
Hello,
could you try to execute this query via phpmyadmin or other tools?

SELECT column_name, referenced_table_name, referenced_column_name FROM information_schema.KEY_COLUMN_USAGE WHERE table_schema = 'your database name here ' and table_name = 'one of your table here' and referenced_table_schema = 'your database name here' and referenced_column_name IS NOT NULL

You should replace 'your database name here' and 'one of your table here' with the actual names of db / table.

Best,
 
[pre]

SELECT
column_name, referenced_table_name, referenced_column_name
FROM
information_schema.KEY_COLUMN_USAGE
WHERE
table_schema = 'firearms'
AND table_name = 'firearms'
AND referenced_table_schema = 'firearms'
AND referenced_column_name IS NOT NULL
[/pre]

I apologize for the column names, I'm using MySQL Workbench to generate the schema. <wink>

[pre]
+----------------------------------------+-----------------------+------------------------+
| COLUMN_NAME | REFERENCED_TABLE_NAME | REFERENCED_COLUMN_NAME |
+----------------------------------------+-----------------------+------------------------+
| caliber_or_gauges_caliber_or_gauges_id | caliber_or_gauges | caliber_or_gauges_id |
| types_firearm_types_id | types | firearm_types_id |
| manufacturers_manufacturers_id | manufacturers | manufacturers_id |
+----------------------------------------+-----------------------+------------------------+
[/pre]
 

eugenio

Administrator
Staff member
Ok, so apparently you don't get any error here. Are you sure that the name of the table and the name of the database are the same?
Did you change anything in the dadabik code?

Let's see which are the tables that produce the error, in /include/db_functions.php

add this code

var_dump($table_name);

just before

$sql = "SELECT column_name, referenced_table_name, referenced_column_name FROM information_schema.KEY_COLUMN_USAGE WHERE table_schema = '".$db_name."' and table_name = '".$table_name."' and referenced_table_schema = '".$db_name."' and referenced_column_name IS NOT NULL";

and past here the result

Best,
 
Not only that, but the name of the user is the same. I have since changed the username to ufirearms. (No change in results, of course.)

I haven't changed anything in dadabik except config.php. I've just used Beyond Compare to compare the original program_files directory to my htdocs\dadabik directory and except for include\config.php, they are identical. Now, of course, there is also a change to db_functions_pdo.php

In htdocs/dadabik/include I have only db_functions_pdo.php, not db_functions.php. I made your suggested change in db_functions_pdo.php.

BTW, since the original post, using MySQL Workbench I have added several tables to the firearms schema. Mostly lookup tables, so there are more sets of errors in this output, since the errors seem to be related to foreign keys.

Just after mentioning a table with foreign keys, there is a set of errors for column_name, referenced_table_name on line 823 and column_name, referenced_column_name on line 824 for each foreign key in that table.

Also, it's curious that near the end, after the installation code is generated, the install output seems to start over with string(10) "businesses" string(17) "caliber_or_gauges" string(10) "conditions" , but then includes string(14) "dadabik_groups" instead of string(12) "descriptions" as it did at the beginning.

I have been dropping the dadabik tables between attempts at install. Is that correct?

Here is the output

[pre]

string(10) "businesses" string(17) "caliber_or_gauges" string(10) "conditions" string(12) "descriptions"
Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824
string(8) "firearms"
Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824
string(13) "manufacturers" string(14) "metal_finishes" string(6) "models" string(7) "nations" string(8) "receipts"
Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 823

Notice: Undefined index: column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 824
string(14) "stock_or_grips" string(6) "twists" string(5) "types"
On-line registration done......your installation code is: 161015f9436d89b4c1

string(10) "businesses" string(17) "caliber_or_gauges" string(10) "conditions" string(14) "dadabik_groups"
Fatal error: Maximum execution time of 120 seconds exceeded in C:\xampp\htdocs\dadabik\include\db_functions_pdo.php on line 186

[/pre]
 

eugenio

Administrator
Staff member
Hello,
yes, sorry, I meant db_functions_pdo.php.

It seems that tables businesses, caliber_or_gauges, conditions don't produce errors, while the table description does it. Can you see any structural difference between them?

The final output is ok, don't worry. There is, however, an additional problem that might impact on the installation: maximum execution time.
Could you increase your php max execution time?

Best,
 
Eugenio,

You're a genius!

In xampp\php\php.ini, I made this change, as suggested:

[pre]
; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
;max_execution_time=120
max_execution_time=600
[/pre]

I ran install again, and lo and behold, it worked!

I still received all those 'Notice:' messages about the undefined stuff from lines 823 and 824, but after those messages:

[pre]
DaDaBIK has been correctly installed
We have created two user groups, admin (having all the permissions, including the permission to edit this application) and normal (having read-only permissions).
We have also created two users: root (password: letizia) belongs to the admin group, alfonso (password: letizia) belongs to the normal group.

You can now view the database application you have just created with DaDaBIK or customize the application from the admin area. Please change the default passwords as soon as you can.

You don't know how to start with the customization? Watch our video tutorials!

[video]

After having installed and configured a DaDaBIK application, it's a good practice to remove the files install.php, install2.php, upgrade.php and upgrade2.php, since they could be used by malicious users in order to change or even re-install your DaDaBIK installation.
[/pre]

I followed the link 'view the database application' and it worked. I can do all CRUD functions on my tables. Now I can get to work customizing my app.

Thank you very much for all the time you spent on resolving this problem for me.

KenC
 

eugenio

Administrator
Staff member
Hello Ken,
you are welcome, I am glad it works now!

However, those warning messages are not normal, there is something that is not working as expected ... coming back to my question, can you see any structural difference between the tables I mentioned?

Best,
 
those warning messages not normal

I see that now <smile>. I may be guilty of celebrating before the crossing goal line <wry grin>.

I've just tried to do a 'single select' on descriptions.firearms_firearms_id and received this in a popup when I navigate out of the field

[pre]
{"readyState":4,"responseText":"string(8) \"firearms\"\n<br />\n<b>Notice</b>: Undefined index: column_name in <b>C:\\xampp\\htdocs\\dadabik\\include\\db_functions_pdo.php</b> on line <b>823</b><br />\n<br />\n<b>Notice</b>: Undefined index: referenced_table_name in <b>C:\\xampp\\htdocs\\dadabik\\include\\db_functions_pdo.php</b> on line <b>823</b><br />\n<br />\n<b>Notice</b>: Undefined index: column_name in <b>C:\\xampp\\htdocs\\dadabik\\include\\db_functions_pdo.php</b> on line <b>824</b><br />\n<br />\n<b>Notice</b>: Undefined index: referenced_column_name in <b>C:\\xampp\\htdocs\\dadabik\\include\\db_functions_pdo.php</b> on line <b>824</b><br />\n<br />\n<b>Notice</b>: Undefined index: column_name in <b>C:\\xampp\\htdocs\\dadabik\\include\\db_functions_pdo.php</b> on line <b>823</b><br />\n<br />\n<b>Notice</b>: Undefined index: referenced_table_name in <b>C:\\xampp\\htdocs\\dadabik\\include\\db_functions_pdo.php</b> on line <b>823</b><br />\n<br />\n<b>Notice</b>: Undefined index: column_name in <b>C:\\xampp\\htdocs\\dadabik\\include\\db_functions_pdo.php</b> on line <b>824</b><br />\n<br />\n<b>Notice</b>: Undefined index: referenced_column_name in <b>C:\\xampp\\htdocs\\dadabik\\include\\db_functions_pdo.php</b> on line <b>824</b><br />\n<br />\n<b>Notice</b>: Undefined index: column_name in <b>C:\\xampp\\htdocs\\dadabik\\include\\db_functions_pdo.php</b> on line <b>823</b><br />\n<br />\n<b>Notice</b>: Undefined index: referenced_table_name in <b>C:\\xampp\\htdocs\\dadabik\\include\\db_functions_pdo.php</b> on line <b>823</b><br />\n<br />\n<b>Notice</b>: Undefined index: column_name in <b>C:\\xampp\\htdocs\\dadabik\\include\\db_functions_pdo.php</b> on line <b>824</b><br />\n<br />\n<b>Notice</b>: Undefined index: referenced_column_name in <b>C:\...
[/pre]

after dismissing this popup, I get another:

[pre]
unexpected error function refresh_internal_table_lookup_fields code 2
[/pre]

Of course, these are the same "not normal" messages from the install, as you rightly pointed out.

The only structural differences that I notice is that descriptions, firearms and receipts are tables that have foreign keys. As such, they have more than one index defined. One for PK and one for each FK.

None of the other tables have FKs, they are 'lookup' tables (they are FKs, so to speak). They have only PK indices.

receipts and descriptions are in a 1:1 optional relationship with firearms. I'm not sure that I understand that explanation <wink> so:

a firearms might have a descriptions, but doesn't need to. A descriptions must have a firearms.

a firearms might have a receipts, but doesn't need to. A receipts must have a firearms.





I hate to include so much text here, but this is the mysql script to recreate schema 'firearms', in case you want to take the time and look for structural oddities yourself.

Each table has a surrogate primary key: 'table_name'_id, and foreign key columns are 'table name'_'table_name'_id

I've generated all of this using MySQL Workbench 8.




[pre]
-- MySQL dump 10.13 Distrib 8.0.22, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: firearms
-- ------------------------------------------------------
-- Server version 8.0.22

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `businesses`
--

DROP TABLE IF EXISTS `businesses`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `businesses` (
`businesses_id` int NOT NULL AUTO_INCREMENT,
`business` text NOT NULL,
`employee` text,
`ffl` text,
`phone` text,
`street1` text,
`street2` text,
`city` text,
`state` text,
`zip` int DEFAULT NULL,
PRIMARY KEY (`businesses_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `caliber_or_gauges`
--

DROP TABLE IF EXISTS `caliber_or_gauges`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `caliber_or_gauges` (
`caliber_or_gauges_id` int NOT NULL AUTO_INCREMENT,
`caliber_or_gauge` text NOT NULL,
PRIMARY KEY (`caliber_or_gauges_id`)
) ENGINE=InnoDB AUTO_INCREMENT=80 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `conditions`
--

DROP TABLE IF EXISTS `conditions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `conditions` (
`conditions_id` int NOT NULL AUTO_INCREMENT,
`condition` text NOT NULL,
`description` text,
PRIMARY KEY (`conditions_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `descriptions`
--

DROP TABLE IF EXISTS `descriptions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `descriptions` (
`descriptions_id` int NOT NULL AUTO_INCREMENT,
`manufacture_date` date DEFAULT NULL,
`c_and_r` enum('yes','no') NOT NULL,
`grooves` text,
`barrel_length` float DEFAULT NULL,
`barrel_threaded` text,
`head_space` text,
`storage_location` text,
`appraised_by` text,
`appraised_value` double DEFAULT NULL,
`appraised_date` date DEFAULT NULL,
`current_value` double DEFAULT NULL,
`current_value_date` date DEFAULT NULL,
`insured_value` double DEFAULT NULL,
`insured_date` date DEFAULT NULL,
`nations_nation_id` int DEFAULT NULL,
`metal_finishes_metal_finish_id` int DEFAULT NULL,
`stock_or_grips_stock_or_grips_id` int DEFAULT NULL,
`twists_twists_id` int DEFAULT NULL,
`conditions_conditions_id` int DEFAULT NULL,
`firearms_firearms_id` int NOT NULL,
PRIMARY KEY (`descriptions_id`),
UNIQUE KEY `firearms_firearms_id_UNIQUE` (`firearms_firearms_id`),
KEY `fk_descriptions_nations1_idx` (`nations_nation_id`),
KEY `fk_descriptions_metal_finishes1_idx` (`metal_finishes_metal_finish_id`),
KEY `fk_descriptions_stock_or_grips1_idx` (`stock_or_grips_stock_or_grips_id`),
KEY `fk_descriptions_twists1_idx` (`twists_twists_id`),
KEY `fk_descriptions_conditions1_idx` (`conditions_conditions_id`),
KEY `fk_descriptions_firearms1_idx` (`firearms_firearms_id`),
CONSTRAINT `fk_descriptions_conditions1` FOREIGN KEY (`conditions_conditions_id`) REFERENCES `conditions` (`conditions_id`) ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT `fk_descriptions_firearms1` FOREIGN KEY (`firearms_firearms_id`) REFERENCES `firearms` (`firearms_id`) ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT `fk_descriptions_metal_finishes1` FOREIGN KEY (`metal_finishes_metal_finish_id`) REFERENCES `metal_finishes` (`metal_finish_id`) ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT `fk_descriptions_nations1` FOREIGN KEY (`nations_nation_id`) REFERENCES `nations` (`nation_id`) ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT `fk_descriptions_stock_or_grips1` FOREIGN KEY (`stock_or_grips_stock_or_grips_id`) REFERENCES `stock_or_grips` (`stock_or_grips_id`) ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT `fk_descriptions_twists1` FOREIGN KEY (`twists_twists_id`) REFERENCES `twists` (`twists_id`) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `firearms`
--

DROP TABLE IF EXISTS `firearms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `firearms` (
`firearms_id` int NOT NULL AUTO_INCREMENT,
`custom_tag` text,
`importer` text,
`serial_number` text,
`innate_capacity` int DEFAULT NULL,
`a_and_d` enum('yes','no') NOT NULL,
`caliber_or_gauges_caliber_or_gauges_id` int NOT NULL,
`manufacturers_manufacturers_id` int NOT NULL,
`types_firearm_types_id` int NOT NULL,
`models_model_id` int NOT NULL,
PRIMARY KEY (`firearms_id`),
KEY `fk_firearms_caliber_or_guages1_idx` (`caliber_or_gauges_caliber_or_gauges_id`),
KEY `fk_firearms_manufacturers1_idx` (`manufacturers_manufacturers_id`),
KEY `fk_firearms_types1_idx` (`types_firearm_types_id`),
KEY `fk_firearms_models1_idx` (`models_model_id`),
CONSTRAINT `fk_firearms_caliber_or_guages1` FOREIGN KEY (`caliber_or_gauges_caliber_or_gauges_id`) REFERENCES `caliber_or_gauges` (`caliber_or_gauges_id`),
CONSTRAINT `fk_firearms_manufacturers1` FOREIGN KEY (`manufacturers_manufacturers_id`) REFERENCES `manufacturers` (`manufacturers_id`),
CONSTRAINT `fk_firearms_models1` FOREIGN KEY (`models_model_id`) REFERENCES `models` (`model_id`) ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT `fk_firearms_types1` FOREIGN KEY (`types_firearm_types_id`) REFERENCES `types` (`firearm_types_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `manufacturers`
--

DROP TABLE IF EXISTS `manufacturers`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `manufacturers` (
`manufacturers_id` int NOT NULL AUTO_INCREMENT,
`manufacturer` varchar(32) NOT NULL,
PRIMARY KEY (`manufacturers_id`)
) ENGINE=InnoDB AUTO_INCREMENT=103 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `metal_finishes`
--

DROP TABLE IF EXISTS `metal_finishes`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `metal_finishes` (
`metal_finish_id` int NOT NULL AUTO_INCREMENT,
`metal_finish` text NOT NULL,
`description` text,
PRIMARY KEY (`metal_finish_id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `models`
--

DROP TABLE IF EXISTS `models`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `models` (
`model_id` int NOT NULL AUTO_INCREMENT,
`model` text NOT NULL,
PRIMARY KEY (`model_id`)
) ENGINE=InnoDB AUTO_INCREMENT=155 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `nations`
--

DROP TABLE IF EXISTS `nations`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `nations` (
`nation_id` int NOT NULL AUTO_INCREMENT,
`nation` text NOT NULL,
`nation_abbr` text,
PRIMARY KEY (`nation_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `receipts`
--

DROP TABLE IF EXISTS `receipts`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `receipts` (
`receipts_id` int NOT NULL AUTO_INCREMENT,
`purchase_price` double DEFAULT NULL,
`purchase_date` date DEFAULT NULL,
`businesses_businesses_id` int DEFAULT NULL,
`firearms_firearms_id` int NOT NULL,
PRIMARY KEY (`receipts_id`),
UNIQUE KEY `firearms_firearms_id_UNIQUE` (`firearms_firearms_id`),
KEY `fk_receipts_businesses1_idx` (`businesses_businesses_id`),
KEY `fk_receipts_firearms1_idx` (`firearms_firearms_id`),
CONSTRAINT `fk_receipts_businesses1` FOREIGN KEY (`businesses_businesses_id`) REFERENCES `businesses` (`businesses_id`) ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT `fk_receipts_firearms1` FOREIGN KEY (`firearms_firearms_id`) REFERENCES `firearms` (`firearms_id`) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `stock_or_grips`
--

DROP TABLE IF EXISTS `stock_or_grips`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `stock_or_grips` (
`stock_or_grips_id` int NOT NULL,
`stock_or_grip` text NOT NULL,
PRIMARY KEY (`stock_or_grips_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `twists`
--

DROP TABLE IF EXISTS `twists`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `twists` (
`twists_id` int NOT NULL,
`twist` text NOT NULL,
PRIMARY KEY (`twists_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `types`
--

DROP TABLE IF EXISTS `types`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `types` (
`firearm_types_id` int NOT NULL AUTO_INCREMENT,
`firearm_type` varchar(20) NOT NULL,
PRIMARY KEY (`firearm_types_id`)
) ENGINE=InnoDB AUTO_INCREMENT=49 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2020-10-26 10:19:24

[/pre]
 
Eugenio,

My 'real' schema, firearms, has become too large and complex for simple testing, so I've created a much simpler subset of the schema, fa_schema, a new mysql user, fa_user and a new dadabik application, ddbfa.

fa_schema has only two tables, firearms and caliber_or_gauges

caliber_or_gauges is a foreign key in firearms. DDL here:

[pre]

CREATE TABLE `caliber_or_gauges` (
`caliber_or_gauges_id` int NOT NULL AUTO_INCREMENT,
`caliber_or_gauge` text NOT NULL,
PRIMARY KEY (`caliber_or_gauges_id`)
) ENGINE=InnoDB AUTO_INCREMENT=80 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci

CREATE TABLE `firearms` (
`firearms_id` int NOT NULL AUTO_INCREMENT,
`custom_tag` text,
`importer` text,
`serial_number` text,
`innate_capacity` int DEFAULT NULL,
`a_and_d` enum('yes','no') NOT NULL,
`caliber_or_gauges_caliber_or_gauges_id` int NOT NULL,
PRIMARY KEY (`firearms_id`),
KEY `fk_firearms_caliber_or_guages1_idx` (`caliber_or_gauges_caliber_or_gauges_id`),
CONSTRAINT `fk_firearms_caliber_or_guages1` FOREIGN KEY (`caliber_or_gauges_caliber_or_gauges_id`) REFERENCES `caliber_or_gauges` (`caliber_or_gauges_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci

[/pre]

My ddbfa enviroment is the same (files copied) as my original dadabik environment, with changes to include/config.php as appropriate.

ddbfa installs with the same errors as dadabik, just fewer of them <grin>:

[pre]
string(17) "caliber_or_gauges" string(14) "dadabik_groups" string(13) "dadabik_users" string(8) "firearms"
Notice: Undefined index: column_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 823

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 823

Notice: Undefined index: column_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 824

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 824
On-line registration done......your installation code is: 161205f977d1838707

string(17) "caliber_or_gauges" string(14) "dadabik_groups" string(13) "dadabik_users" string(8) "firearms"
Notice: Undefined index: column_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 823

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 823

Notice: Undefined index: column_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 824

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 824
[/pre]

As before, the app runs, but the Forms configurator issues the same errors as the original when I try to make firearms.caliber_or_gauges_caliber_or_gauges_id a single select on caliber_or_gauges

[pre]
{"readyState":4,"responseText":"string(17) \"caliber_or_gauges\"\n{\"fields\":[\"caliber_or_gauges_id\",\"caliber_or_gauge\"],\"status\":\"ok\"}","status":200,"statusText":"OK"}
[/pre]


This is such a simple example that table structure shouldn't be an issue.

There must be something in my environment. Here I repeat it for convenience's sake:

[pre]
ApacheFriends XAMPP Version 7.4.11

Apache 2.4.46

Current PHP version: 7.4.11 OK

mbsgtring extension: Installed

ioncube extension: Installed

ioncube extension version: 10.4 OK

Check DB connection: OK

mysql version: 8.0.22 OK

installation URL = http://localhost/ddbfa/
dbms_type = mysql
installation_type (db, blank, csv, xml, ods or prepackaged)
dadabik_version = 10.3-Manarola pro
os = Windows NT
php_version = 7.4.11
date_time = 2020-10-26 22:29:21

Chrome Version 86.0.4240.111 (Official Build) (64-bit)
[/pre]

BTW, if I create the fa_schema with only two tables, no foreign keys, ddbfa installs with no 'notices', just the output from the var_dump()s and your output.
 

eugenio

Administrator
Staff member
Hello,
could you try the query with one of the tables that produce the error, for example the table description?

SELECT
column_name, referenced_table_name, referenced_column_name
FROM
information_schema.KEY_COLUMN_USAGE
WHERE
table_schema = 'firearms'
AND table_name = 'description'
AND referenced_table_schema = 'firearms'
AND referenced_column_name IS NOT NULL
 
Eugenio,

I've used my new testing app ddbfa with schema fa_schema mentioned in my prior message.

[pre]
mysql> use fa_schema
Database changed
mysql> SELECT column_name, referenced_table_name, referenced_column_name
-> FROM information_schema.KEY_COLUMN_USAGE
-> WHERE table_schema = 'fa_schema'
-> AND table_name = 'caliber_or_gauges'
-> AND referenced_table_schema = 'fa_schema'
-> AND referenced_column_name IS NOT NULL;
Empty set (0.00 sec)

To demonstrate that the foreign key caliber_or_gauges -----> firearms actually exists.

mysql> SELECT column_name, referenced_table_name, referenced_column_name
-> FROM information_schema.KEY_COLUMN_USAGE
-> WHERE table_schema = 'fa_schema'
-> AND table_name = 'firearms'
-> AND referenced_table_schema = 'fa_schema'
-> AND referenced_column_name IS NOT NULL;
+----------------------------------------+-----------------------+------------------------+
| COLUMN_NAME | REFERENCED_TABLE_NAME | REFERENCED_COLUMN_NAME |
+----------------------------------------+-----------------------+------------------------+
| caliber_or_gauges_caliber_or_gauges_id | caliber_or_gauges | caliber_or_gauges_id |
+----------------------------------------+-----------------------+------------------------+
1 row in set (0.01 sec)
[/pre]
 

eugenio

Administrator
Staff member
caliber_or_gauges was one of the tables that didn't produce errors, you should try with description

Best,
 
[pre]
mysql> SELECT column_name, referenced_table_name, referenced_column_name
-> FROM information_schema.KEY_COLUMN_USAGE
-> WHERE table_schema = 'firearms'AND table_name = 'descriptions'
-> AND referenced_table_schema = 'firearms'
-> AND referenced_column_name IS NOT NULL;
+----------------------------------+-----------------------+------------------------+
| COLUMN_NAME | REFERENCED_TABLE_NAME | REFERENCED_COLUMN_NAME |
+----------------------------------+-----------------------+------------------------+
| conditions_conditions_id | conditions | conditions_id |
| firearms_firearms_id | firearms | firearms_id |
| metal_finishes_metal_finish_id | metal_finishes | metal_finish_id |
| nations_nation_id | nations | nation_id |
| stock_or_grips_stock_or_grips_id | stock_or_grips | stock_or_grips_id |
| twists_twists_id | twists | twists_id |
+----------------------------------+-----------------------+------------------------+
6 rows in set (0.00 sec)
[/pre]
 

eugenio

Administrator
Staff member
That's very strange, everything seems ok.

I would try this, using your new and smaller db, before:

$fks[$row['column_name']]['referenced_table_name'] = $row['referenced_table_name']; (which should be line 823, do you confirm?)

you should add

var_dump($row);

and launch the install script to see what is displayed.

Best,
 
Yes, I concur line 823, now 824.

[pre]
$fks=array();
foreach (execute_db($sql, $conn) as $row){
var_dump($row);
$fks[$row['column_name']]['referenced_table_name'] = $row['referenced_table_name'];
[/pre]

Results:

[pre]
string(17) "caliber_or_gauges" string(8) "firearms" array(6) { ["COLUMN_NAME"]=> string(38) "caliber_or_gauges_caliber_or_gauges_id" [0]=> string(38) "caliber_or_gauges_caliber_or_gauges_id" ["REFERENCED_TABLE_NAME"]=> string(17) "caliber_or_gauges" [1]=> string(17) "caliber_or_gauges" ["REFERENCED_COLUMN_NAME"]=> string(20) "caliber_or_gauges_id" [2]=> string(20) "caliber_or_gauges_id" }
Notice: Undefined index: column_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 824

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 824

Notice: Undefined index: column_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 825

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 825
On-line registration done......your installation code is: 161265f9854c1613e4

string(17) "caliber_or_gauges" string(14) "dadabik_groups" string(13) "dadabik_users" string(8) "firearms" array(6) { ["COLUMN_NAME"]=> string(38) "caliber_or_gauges_caliber_or_gauges_id" [0]=> string(38) "caliber_or_gauges_caliber_or_gauges_id" ["REFERENCED_TABLE_NAME"]=> string(17) "caliber_or_gauges" [1]=> string(17) "caliber_or_gauges" ["REFERENCED_COLUMN_NAME"]=> string(20) "caliber_or_gauges_id" [2]=> string(20) "caliber_or_gauges_id" }
Notice: Undefined index: column_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 824

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 824

Notice: Undefined index: column_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 825

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 825
[/pre]
 

eugenio

Administrator
Staff member
Ok, got it.

Try to change these lines

$fks[$row['column_name']]['referenced_table_name'] = $row['referenced_table_name'];
$fks[$row['column_name']]['referenced_field_name'] = $row['referenced_column_name'];

to

$fks[$row['COLUMN_NAME']]['referenced_table_name'] = $row['REFERENCED_TABLE_NAME'];
$fks[$row['COLUMN_NAME']]['referenced_field_name'] = $row['REFERENCED_COLUMN_NAME'];


and let me know if everything works now.

Best,
 
[pre]
$fks=array();
foreach (execute_db($sql, $conn) as $row){
var_dump($row);
; $fks[$row['column_name']]['referenced_table_name'] = $row['referenced_table_name'];
$fks[$row['COLUMN_NAME']]['referenced_table_name'] = $row['REFERENCED_TABLE_NAME'];
; $fks[$row['column_name']]['referenced_field_name'] = $row['referenced_column_name'];
$fks[$row['COLUMN_NAME']]['referenced_field_name'] = $row['REFERENCED_COLUMN_NAME'];
}

[/pre]

Results

[pre]
string(17) "caliber_or_gauges" string(8) "firearms" array(6) { ["COLUMN_NAME"]=> string(38) "caliber_or_gauges_caliber_or_gauges_id" [0]=> string(38) "caliber_or_gauges_caliber_or_gauges_id" ["REFERENCED_TABLE_NAME"]=> string(17) "caliber_or_gauges" [1]=> string(17) "caliber_or_gauges" ["REFERENCED_COLUMN_NAME"]=> string(20) "caliber_or_gauges_id" [2]=> string(20) "caliber_or_gauges_id" }
Notice: Undefined index: column_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 824

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 824

Notice: Undefined index: column_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 825

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 825
On-line registration done......your installation code is: 161275f985c8e13d2c

string(17) "caliber_or_gauges" string(14) "dadabik_groups" string(13) "dadabik_users" string(8) "firearms" array(6) { ["COLUMN_NAME"]=> string(38) "caliber_or_gauges_caliber_or_gauges_id" [0]=> string(38) "caliber_or_gauges_caliber_or_gauges_id" ["REFERENCED_TABLE_NAME"]=> string(17) "caliber_or_gauges" [1]=> string(17) "caliber_or_gauges" ["REFERENCED_COLUMN_NAME"]=> string(20) "caliber_or_gauges_id" [2]=> string(20) "caliber_or_gauges_id" }
Notice: Undefined index: column_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 824

Notice: Undefined index: referenced_table_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 824

Notice: Undefined index: column_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 825

Notice: Undefined index: referenced_column_name in C:\xampp\htdocs\ddbfa\include\db_functions_pdo.php on line 825
string(17) "caliber_or_gauges"
[/pre]
 
Top