Welcome Guest, Not a member yet? Register   Sign In
You must use the "set" method to update an entry. (Again)
#5

(This post was last modified: 10-13-2020, 02:28 PM by Petrusilius.)

Hello,
thx again for the fast answer, what I did right now was, I've made an SQL export of the database and double checked it again. Did that also yesterday, but to be sure. Sorry for comments in german in the dump. What I did also was testing another method in the model to ensure the connection to the database in general works, at least that I could ensure. I also tried to reduce the amount of parameters to find the problematic one, but unfortunately that also didn't help.

I've also added here now my Code from CI3 that has worked with the same database, when also done in a different way. (I tried this already, but same result Sad )


SQL Dump
Code:
-- phpMyAdmin SQL Dump
-- version 4.9.2
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Erstellungszeit: 13. Okt 2020 um 22:41
-- Server-Version: 10.3.21-MariaDB
-- PHP-Version: 7.2.29

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!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 */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Datenbank: `users`
--

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `user`
--

CREATE TABLE `user` (
  `id` int(11) NOT NULL,
  `role_id` int(11) NOT NULL DEFAULT 1,
  `first_name` varchar(25) NOT NULL,
  `last_name` varchar(25) NOT NULL,
  `username` varchar(25) NOT NULL,
  `password` blob DEFAULT NULL,
  `email_address` blob DEFAULT NULL,
  `mail_me` tinyint(1) NOT NULL DEFAULT 0,
  `ack_round` tinyint(1) NOT NULL DEFAULT 0,
  `language` enum('de-de','en-us') NOT NULL DEFAULT 'de-de',
  `referee` int(11) DEFAULT NULL,
  `xp` int(11) NOT NULL DEFAULT 0,
  `uuid` char(36) NOT NULL,
  `activation_token` varchar(255) NOT NULL,
  `activation` tinyint(1) NOT NULL DEFAULT 0,
  `dsgvo` tinyint(1) NOT NULL DEFAULT 0,
  `notified` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Indizes der exportierten Tabellen
--

--
-- Indizes für die Tabelle `user`
--
ALTER TABLE `user`
  ADD PRIMARY KEY (`id`,`username`),
  ADD UNIQUE KEY `username` (`username`),
  ADD KEY `role_id` (`role_id`),
  ADD KEY `referee` (`referee`);

--
-- AUTO_INCREMENT für exportierte Tabellen
--

--
-- AUTO_INCREMENT für Tabelle `user`
--
ALTER TABLE `user`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;

--
-- Constraints der exportierten Tabellen
--

--
-- Constraints der Tabelle `user`
--
ALTER TABLE `user`
  ADD CONSTRAINT `user_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`),
  ADD CONSTRAINT `user_ibfk_2` FOREIGN KEY (`referee`) REFERENCES `user` (`id`) ON DELETE SET NULL ON UPDATE SET NULL;
COMMIT;

/*!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 */;

Old Code from CI3
PHP Code:
    $users $this->load->database('users'TRUE);
    $insert $users->set('first_name'$this->input->post('first_name'))
            ->set('last_name'$this->input->post('last_name'))
            ->set('email_address'$this->input->post('email_address'))
            ->set('username'$this->input->post('username'))
            ->set('password'$hash)
            ->set('uuid''UUID()'false)
            //TODO: ->set('referee', $this->session->userdata('user_id'))
            ->set('activation_token'$token)
            ->insert('user'); 

Additionally the Call Stack from the log
Code:
CRITICAL - 2020-10-13 16:24:38 --> You must use the "set" method to update an entry.
#0 /volume1/web/Commercia/system/Database/BaseBuilder.php(2234): CodeIgniter\Database\BaseBuilder->validateInsert()
#1 /volume1/web/Commercia/system/Model.php(755): CodeIgniter\Database\BaseBuilder->insert()
#2 /volume1/web/Commercia/app/Models/UserModel.php(97): CodeIgniter\Model->insert(Array)
#3 /volume1/web/Commercia/app/Controllers/Test/UserModelTest.php(11): App\Models\UserModel->create_user('MrXXX', '12345678', 'Max', 'Muster', '[email protected]')
#4 /volume1/web/Commercia/system/CodeIgniter.php(918): App\Controllers\Test\UserModelTest->CreateUserTest()
#5 /volume1/web/Commercia/system/CodeIgniter.php(404): CodeIgniter\CodeIgniter->runController(Object(App\Controllers\Test\UserModelTest))
#6 /volume1/web/Commercia/system/CodeIgniter.php(312): CodeIgniter\CodeIgniter->handleRequest(NULL, Object(Config\Cache), false)
#7 /volume1/web/Commercia/public/index.php(45): CodeIgniter\CodeIgniter->run()
#8 {main}
Reply


Messages In This Thread
RE: You must use the "set" method to update an entry. (Again) - by Petrusilius - 10-13-2020, 02:01 PM



Theme © iAndrew 2016 - Forum software by © MyBB