Jump to content

Bad SQL query


majorcode

Recommended Posts

Hello members,

I moved my whole site from one domain to another. Everything is working perfect except when I click on Customers>Customers

I received the following error

Bad SQL query
Table 'XXXXX_XXX.ps_connections' doesn't exist

Kindly help to fix this issue.

Thank you

 

Edited by majorcode
typing error (see edit history)
Link to comment
Share on other sites

23 hours ago, joseantgv said:

Table ps_connections doesn't exist.

The migration from one server to another has not been successful. 

You'd better export/import database again.

Hello Jose, any other solution as I really worked on the website for more than 2 months. I am afraid to do some bigger mess.

No worries about old data, how i can fix it without re import/export.

Advise please!

 

 

 

Link to comment
Share on other sites

16 hours ago, Prescol said:

In PhpMyAdmin export the table structure for xx_connections table. Not content, only structure. Then in your production database import that table.

Thank you Prescol, can I just re-create the table? Since its been two month I am adding products into my shop therefore I am afraid not to do any big mess.

Link to comment
Share on other sites

Prestashop analytics was a good thing back when every analytics were a paid service. Since Google Analytics, as joseantgv says, it has no really sense to keep them enabled. Disabling them can even increase performance on your site. 

Edited by Prescol
wrong english. (see edit history)
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 1 year later...

When I click on "Customers" or "Shopping Carts"

PS 1.7.7.4

An exception occurred while executing 'SELECT c.id_customer, c.firstname, c.lastname, c.email, c.active, c.newsletter, c.optin, c.date_add, gl.name as social_title, s.name as shop_name, c.company, (SELECT SUM(total_paid_real / conversion_rate) FROM ps_orders o WHERE (o.id_customer = c.id_customer) AND (o.id_shop IN (?)) AND (o.valid = 1)) as total_spent, (SELECT con.date_add FROM ps_guest g LEFT JOIN ps_connections con ON con.id_guest = g.id_guest WHERE g.id_customer = c.id_customer ORDER BY con.date_add DESC LIMIT 1) as connect FROM ps_customer c LEFT JOIN ps_gender_lang gl ON c.id_gender = gl.id_gender AND gl.id_lang = ? LEFT JOIN ps_shop s ON c.id_shop = s.id_shop WHERE (c.deleted = 0) AND (c.id_shop IN (?)) ORDER BY c.date_add DESC LIMIT 50' with params [1, 1, 1]: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'XXX_XXXX.ps_connections' doesn't exist

[Doctrine\DBAL\Exception\TableNotFoundException 0]

Link to comment
Share on other sites

Then execute this query:

CREATE TABLE `ps_connections` (
  `id_connections` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `id_shop_group` int(11) unsigned NOT NULL DEFAULT 1,
  `id_shop` int(11) unsigned NOT NULL DEFAULT 1,
  `id_guest` int(10) unsigned NOT NULL,
  `id_page` int(10) unsigned NOT NULL,
  `ip_address` bigint(20) DEFAULT NULL,
  `date_add` datetime NOT NULL,
  `http_referer` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id_connections`),
  KEY `id_guest` (`id_guest`),
  KEY `date_add` (`date_add`),
  KEY `id_page` (`id_page`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...