1

I am using the following code for creating tables in my .sql file as part of a module.

CREATE TABLE IF NOT EXISTS `#__gruposlocales` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `name` varchar(255) NOT NULL,
    `latitude` float(10,6) NOT NULL DEFAULT '255.000000',
    `longitude` float(10,6) NOT NULL DEFAULT '255.000000',

  PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;

INSERT INTO `#__gruposlocales` (`id`, `latitude`, `longitude`) SELECT userid, latitude, longitude FROM `#__community_users`;
INSERT INTO `#__gruposlocales` (`name`) SELECT name FROM `#__community_groups` WHERE id=ownerid;

However, when I try to install the module, I get this error:

JInstaller: :Install: Error SQL Unknown column 'latitude' in 'field list' Extension Install: SQL error processing query: DB function failed with error number 1054 Unknown column 'latitude' in 'field list' SQL = INSERT INTO `#__gruposlocales` (`id`, `latitude`, `longitude`) SELECT userid, latitude, longitude FROM `#__community_users`;

Is my code wrong? Could anybody help to fix this, please?

13
  • 2
    The table you select from has a latitude field? Mar 1, 2018 at 5:54
  • Yes, @SvenBluege, one of the table I select from has the following fields: userid, latitude, and longitude. The code works perfectly inside of phpmyAdmin, creating the requested table from those two other tables. Mar 1, 2018 at 13:27
  • Has your database user more than one joomla installation? Did you use the right replacement for #__ while running it in phpmyadmin? Another Idea: bugs.mysql.com/bug.php?id=1689 Mar 1, 2018 at 16:37
  • Thank you, Sven. Yes, there a more than one Joomla installation and yes I used the #_jos fashion. I read the article you kindly pointed me out. I have followed every suggestion but I get the same error. As for the grave accents instead of straight quote marks, I have this code that works well with no complains: INSERT INTO #__helloworld (hello, lang) VALUES ('Hello World', 'en-GB'); INSERT INTO #__helloworld (hello, lang) VALUES ('Hola Mundo', 'es-ES'); INSERT INTO #__helloworld (hello, lang) VALUES ('Bonjour tout le monde', 'fr-FR'); Mar 1, 2018 at 23:10
  • The grave accents are not visible and I don't know how to fix it. Mar 1, 2018 at 23:17

1 Answer 1

1

Your database contained more than one Joomla table set. The install script got confused by that.

1
  • I think for the green tick, this answer needs a bit more context from the string of comments. Please write a comprehensive answer that can stand alone in case comments are deleted.
    – mickmackusa
    May 27, 2018 at 2:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.