1
General Support / Re: New install on localhost has database connection problems
« on: July 27, 2016, 09:34:09 AM »
Brand new to forum....
I had the same problem...
during the install on my localhost at the point where the demo data is being loaded I got this DB error
================
Name Info
10000::database error
SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
near 'AND st.status = 1 AND se.`group` NOT IN (SELECT `key` FROM extensions)' at line 4
Error No: 1064
SQL: SELECT se.`key`, se.`value`, st.store_id FROM settings se RIGHT JOIN stores st ON se.store_id = st.store_id
WHERE se.store_id = AND st.status = 1
AND se.`group` NOT IN (SELECT `key` FROM extensions); in C:\www\public_html\store\core\database\amysqli.php on line 106
================
The SQL issue is in the part of the query
**** WHERE se.store_id = AND st.status = 1 ****
there is no value after se.store_id
I debugged the code and not sure where store ID should be properly set but this is where I found / fixed a bug and the install worked for me
===============
/core/lib/config.php around line 230 in method _load_settings()
org code ( line 230 is last line below and is what I changed)
===========
if (IS_ADMIN) {
//Check if admin has specific store in session or selected
$session = $this->registry->get('session');
$store_id = $this->registry->get('request')->get['store_id'];
if (has_value($store_id)) {
$this->cnfg['current_store_id'] = (int)$store_id;
} else if(has_value($session->data['current_store_id'])) {
$this->cnfg['current_store_id'] = $session->data['current_store_id'];
} else {
//nothing to do
$this->cnfg['current_store_id'] = $session->data['config_store_id'];
new code
==============
if (IS_ADMIN) {
//Check if admin has specific store in session or selected
$session = $this->registry->get('session');
$store_id = $this->registry->get('request')->get['store_id'];
if (has_value($store_id)) {
$this->cnfg['current_store_id'] = (int)$store_id;
} else if(has_value($session->data['current_store_id'])) {
$this->cnfg['current_store_id'] = $session->data['current_store_id'];
} else {
//nothing to do
// but above test shows this has no value...so assign default of 0
// install fails
// CLT 7/27/16
$this->cnfg['current_store_id'] = 0; // $session->data['config_store_id'];
=====================
NOTE: I had to start my install fresh
delete my DB
unpack the source again
make the above code change
before I re-ran the install so the whole install would start over.....but the above change worked for me
I had the same problem...
during the install on my localhost at the point where the demo data is being loaded I got this DB error
================
Name Info
10000::database error
SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
near 'AND st.status = 1 AND se.`group` NOT IN (SELECT `key` FROM extensions)' at line 4
Error No: 1064
SQL: SELECT se.`key`, se.`value`, st.store_id FROM settings se RIGHT JOIN stores st ON se.store_id = st.store_id
WHERE se.store_id = AND st.status = 1
AND se.`group` NOT IN (SELECT `key` FROM extensions); in C:\www\public_html\store\core\database\amysqli.php on line 106
================
The SQL issue is in the part of the query
**** WHERE se.store_id = AND st.status = 1 ****
there is no value after se.store_id
I debugged the code and not sure where store ID should be properly set but this is where I found / fixed a bug and the install worked for me
===============
/core/lib/config.php around line 230 in method _load_settings()
org code ( line 230 is last line below and is what I changed)
===========
if (IS_ADMIN) {
//Check if admin has specific store in session or selected
$session = $this->registry->get('session');
$store_id = $this->registry->get('request')->get['store_id'];
if (has_value($store_id)) {
$this->cnfg['current_store_id'] = (int)$store_id;
} else if(has_value($session->data['current_store_id'])) {
$this->cnfg['current_store_id'] = $session->data['current_store_id'];
} else {
//nothing to do
$this->cnfg['current_store_id'] = $session->data['config_store_id'];
new code
==============
if (IS_ADMIN) {
//Check if admin has specific store in session or selected
$session = $this->registry->get('session');
$store_id = $this->registry->get('request')->get['store_id'];
if (has_value($store_id)) {
$this->cnfg['current_store_id'] = (int)$store_id;
} else if(has_value($session->data['current_store_id'])) {
$this->cnfg['current_store_id'] = $session->data['current_store_id'];
} else {
//nothing to do
// but above test shows this has no value...so assign default of 0
// install fails
// CLT 7/27/16
$this->cnfg['current_store_id'] = 0; // $session->data['config_store_id'];
=====================
NOTE: I had to start my install fresh
delete my DB
unpack the source again
make the above code change
before I re-ran the install so the whole install would start over.....but the above change worked for me