Welcome Guest, Not a member yet? Register   Sign In
Table short name and queries
#1

Hey all. Using CI 4.2.6 and having some issues with trying to use a table short name in my queries.
In my model if I put:
PHP Code:
protected $table 'mailing_suggestedchanges msc'

And do:

PHP Code:
$sugChanges $this->mlChangesModel ->select('msc.ml_id, msc.created_at,')
                                    ->where('msc.is_active',1)
                                    ->findAll(); 
Everything works as expected. However, later on:

PHP Code:
$data = array(
      'is_active' => 0,
); 

PHP Code:
$this->mlChangesModel->update($id,$data); 


Throws this error:
Code:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '`msc`.`id` IN ('3')' at line 2

Removing the short name and updating the queries to use the full table name makes everything work again.
Any suggestions? Am I using the shortname incorrectly?
Reply


Messages In This Thread
Table short name and queries - by SoccerGuy3 - 11-07-2022, 04:37 PM
RE: Table short name and queries - by kenjis - 11-07-2022, 04:53 PM
RE: Table short name and queries - by SoccerGuy3 - 11-07-2022, 05:36 PM
RE: Table short name and queries - by kenjis - 11-07-2022, 06:00 PM
RE: Table short name and queries - by SoccerGuy3 - 11-08-2022, 09:49 AM
RE: Table short name and queries - by kenjis - 11-08-2022, 04:46 PM
RE: Table short name and queries - by SoccerGuy3 - 11-08-2022, 04:50 PM
RE: Table short name and queries - by davis.lasis - 11-09-2022, 12:30 AM
RE: Table short name and queries - by SoccerGuy3 - 11-09-2022, 05:25 PM
RE: Table short name and queries - by kenjis - 11-09-2022, 12:37 AM
RE: Table short name and queries - by SoccerGuy3 - 11-10-2022, 08:56 AM
RE: Table short name and queries - by kenjis - 11-10-2022, 06:42 PM
RE: Table short name and queries - by SoccerGuy3 - 11-11-2022, 07:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB