1084

Sql error upon loading

Comments for “Sql error upon loading”
 

Posted by delta13dek on Friday 16th February 2024 at 22:58 GMT

I have a sql error upon downloading the trongate zip file from git.


Fatal error: Uncaught Error: Call to a member function prepare() on null in C:\xampp\htdocs\my_app_trongate\engine\Model.php:553
Stack trace:
#0 C:\xampp\htdocs\my_app_trongate\engine\tg_transferer\Transferer.php(83): Model->exec('SET SQL_MODE = ...')
#1 C:\xampp\htdocs\my_app_trongate\engine\tg_transferer\Transferer.php(35): Transferer->run_sql('SET SQL_MODE = ...')
#2 C:\xampp\htdocs\my_app_trongate\engine\tg_transferer\index.php(7): Transferer->process_post()
#3 C:\xampp\htdocs\my_app_trongate\engine\Core.php(181): require_once('C:\\xampp\\htdocs...')
#4 C:\xampp\htdocs\my_app_trongate\engine\Core.php(250): Core->attempt_sql_transfer('../modules/welc...')
#5 C:\xampp\htdocs\my_app_trongate\engine\Core.php(22): Core->serve_controller()
#6 C:\xampp\htdocs\my_app_trongate\public\index.php(5): Core->__construct()
#7 {main}
thrown in C:\xampp\htdocs\my_app_trongate\engine\Model.php on line 553


what should I do ?

Thanks,
Level One Member

delta13dek

User Level: Level One Member

Date Joined: 14/02/2024

Posted by djnordeen on Saturday 17th February 2024 at 00:55 GMT

Hello,
First, after downloading the zip from github, what were the next steps that you did?
Why did you not use the Trongate app to install Trongate?
https://trongate.io/download

Did you create a database in the config file to link to?

Dan
Early Adopter

djnordeen

User Level: Early Adopter

Date Joined: 20/08/2021

Posted by delta13dek on Saturday 17th February 2024 at 14:50 GMT

Hi,
I didn't do anything but follow the learning zone video. I have the desktop app working fine, I just thought i had to download the zip file to do the learning zone.

Thanks,
Level One Member

delta13dek

User Level: Level One Member

Date Joined: 14/02/2024

Posted by delta13dek on Saturday 17th February 2024 at 14:57 GMT

when I put my base URL in the browser, I get a screen the says 'SQL FILES FOUND'...

The I hit the view sql button and it give me the following code

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;

CREATE TABLE IF NOT EXISTS `trongate_administrators` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(65) DEFAULT NULL,
  `password` varchar(60) DEFAULT NULL,
  `trongate_user_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

INSERT INTO `trongate_administrators` (`id`, `username`, `password`, `trongate_user_id`) VALUES
(1, 'admin', '$2y$11$SoHZDvbfLSRHAi3WiKIBiu.tAoi/GCBBO4HRxVX1I3qQkq3wCWfXi', 1);

CREATE TABLE IF NOT EXISTS `trongate_comments` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `comment` text DEFAULT NULL,
  `date_created` int(11) DEFAULT 0,
  `user_id` int(11) DEFAULT NULL,
  `target_table` varchar(125) DEFAULT NULL,
  `update_id` int(11) DEFAULT NULL,
  `code` varchar(6) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `trongate_pages` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `url_string` varchar(255) DEFAULT NULL,
  `page_title` varchar(255) DEFAULT NULL,
  `meta_keywords` text DEFAULT NULL,
  `meta_description` text DEFAULT NULL,
  `page_body` text DEFAULT NULL,
  `date_created` int(11) DEFAULT NULL,
  `last_updated` int(11) DEFAULT NULL,
  `published` tinyint(1) DEFAULT NULL,
  `created_by` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `trongate_tokens` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `token` varchar(125) DEFAULT NULL,
  `user_id` int(11) DEFAULT 0,
  `expiry_date` int(11) DEFAULT NULL,
  `code` varchar(3) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `trongate_users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(32) DEFAULT NULL,
  `user_level_id` int(11) DEFAULT 0,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

INSERT INTO `trongate_users` (`id`, `code`, `user_level_id`) VALUES
(1, 'Tz8tehsWsTPUHEtzfbYjXzaKNqLmfAUz', 1);

CREATE TABLE IF NOT EXISTS `trongate_user_levels` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `level_title` varchar(125) DEFAULT '',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

INSERT INTO `trongate_user_levels` (`id`, `level_title`) VALUES
(1, 'admin');
COMMIT;


If i don't need the zip file to continue the learning zone then Let me know and I'll continue with the desktop app.

Thanks,
Level One Member

delta13dek

User Level: Level One Member

Date Joined: 14/02/2024

Posted by djnordeen on Saturday 17th February 2024 at 15:16 GMT

Ok, Try to create an app with the desktop app. It will automactially ask you to load the sql files and create the database. It is alot easier this way.

Edit:
You can also open you phpmyadmin and paste in the sql to create your tables.


Dan

This comment was edited by djnordeen on Saturday 17th February 2024 at 18:21 GMT

Early Adopter

djnordeen

User Level: Early Adopter

Date Joined: 20/08/2021

×