Welcome Guest, Not a member yet? Register   Sign In
use of Unique in mySQL field cases Error
#19

(This post was last modified: 07-26-2020, 05:45 PM by richb201.)

I put the CodeIgniter\Model; into the top of the model. When I run that it seems to work fine except the "$this" still doesn't appear in the model. 

I do see db under CI in the model. Do I perhaps need to open a separate connection to the mySQL table? 

Then I pasted namespace application\models; into the top of the controller.
require 'vendor/autoload.php';
namespace application\models;

I get this error when i do this:
Severity: Compile Error

Message: Namespace declaration statement has to be the very first statement or after any declare call in the script

Filename: controllers/Configure.php

Line Number: 4

Backtrace:

Strangely, although $this is {MyModel}[0] in the debugger in the model, it appears to be working (not the code but at least the first few lines, see below).
$this->db->where('email', $_SESSION['userid']);
$this->db->where('campaign', $_SESSION['campaign']);
$this->db->select('*');
$query = $this->db->get('stat_sample');


how can that be?  Well, somehow it is working! 
proof that an old dog can learn new tricks
Reply


Messages In This Thread
RE: use of Unique in mySQL field cases Error - by richb201 - 07-26-2020, 04:15 PM



Theme © iAndrew 2016 - Forum software by © MyBB