timestamp error in mysql while installing magento - mysql

i am having an error in mysql while installing magento in server`
currently mysql version is 5.5
a:5:{i:0;s:295:"Error in file: "/home/jobixcoindia/public_html/app/code/local/Ced/CsMarketplace/sql/csmarketplace_setup/mysql4-upgrade-0.0.3-0.0.4.php" - SQLSTATE[HY000]: General error: 1293 Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause";i:1;s:1012:"#0 /home/jobixcoindia/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(644): Mage::exception('Mage_Core', 'Error in file: ...')
#1 /home/jobixcoindia/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(437): Mage_Core_Model_Resource_Setup->_modifyResourceDb('upgrade', '0.0.3', '0.0.28')
#2 /home/jobixcoindia/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(320): Mage_Core_Model_Resource_Setup->_upgradeResourceDb('0.0.3', '0.0.28')
#3 /home/jobixcoindia/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(235): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /home/jobixcoindia/public_html/app/code/core/Mage/Core/Model/App.php(428): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /home/jobixcoindia/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Model_App->_initModules()
#6 /home/jobixcoindia/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#7 /home/jobixcoindia/public_html/index.php(83): Mage::run('', 'store')
#8 {main}";s:3:"url";s:1:"/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}
`

Magento Column for date should be TYPE of DATETIME, like default CURRENT_TIMESTAMP

Related

Getting 'Subquery returns more than 1 row' when updating a row - MariaDB

I got an error
SQLSTATE[21000]: Cardinality violation: 1242 Subquery returns more
than 1 row (SQL: update submissions set status = 2, updated_at =
'2020-11-11 09:02:27' where id = 85213835).
I'm using Eloquent ORM 5.7 and the the code is looks like this
$builder->update([
'status' => $request->getParam('new_status'),
'rejection_message' => $request->getParam('rejection_message') ? $request->getParam('rejection_message') : ""
]);
Previously the code was running well and just got this error recently.

Yii2: yii\db\Exception 42000 on quotation(') search

Hi i have problem with Yii2 search model.
when user try to search with quotation (for example it's) this exeption Thrown:
SQLSTATE[42000]: Syntax error or access violation: 1064 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 's%' )' at line 1
The SQL being executed was:
SELECT COUNT(*) FROM `user` `t` WHERE id in (SELECT user_id from user_profile WHERE nickname like '%it's%' )
Stack trace:
#0 \vendor\yiisoft\yii2\db\Command.php(900): PDOStatement->execute()
#1 \vendor\yiisoft\yii2\db\Command.php(388): yii\db\Command->queryInternal('fetchColumn', 0)
#2 \vendor\yiisoft\yii2\db\Query.php(393): yii\db\Command->queryScalar()
#3 \vendor\yiisoft\yii2\db\ActiveQuery.php(334): yii\db\Query->queryScalar('COUNT(*)', NULL)
#4 \vendor\yiisoft\yii2\db\Query.php(300): yii\db\ActiveQuery->queryScalar('COUNT(*)', NULL)
#5 \vendor\yiisoft\yii2\data\ActiveDataProvider.php(165): yii\db\Query->count('*', NULL)
#6 \vendor\yiisoft\yii2\data\BaseDataProvider.php(147): yii\data\ActiveDataProvider->prepareTotalCount()
#7 \vendor\yiisoft\yii2\base\Component.php(130): yii\data\BaseDataProvider->getTotalCount()
#8 \app\modules\post\views\default\search.php(47): yii\base\Component->__get('totalCount')
#9 \vendor\yiisoft\yii2\base\View.php(325): require('...')
#10 \vendor\yiisoft\yii2\base\View.php(247): yii\base\View->renderPhpFile('...', Array)
#11 \vendor\yiisoft\yii2\base\View.php(149): yii\base\View->renderFile('...', Array, Object(app\modules\post\controllers\DefaultController))
#12 \vendor\yiisoft\yii2\base\Controller.php(378): yii\base\View->render('search', Array, Object(app\modules\post\controllers\DefaultController))
#13 \app\modules\post\controllers\DefaultController.php(94): yii\base\Controller->render('search', Array)
#14 [internal function]: app\modules\post\controllers\DefaultController->actionSearch(''"', NULL, NULL)
#15 \vendor\yiisoft\yii2\base\InlineAction.php(55): call_user_func_array(Array, Array)
#16 \vendor\yiisoft\yii2\base\Controller.php(154): yii\base\InlineAction->runWithParams(Array)
#17 \vendor\yiisoft\yii2\base\Module.php(454): yii\base\Controller->runAction('search', Array)
#18 \vendor\yiisoft\yii2\web\Application.php(87): yii\base\Module->runAction('post/default/se...', Array)
#19 \vendor\yiisoft\yii2\base\Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))
#20 \app\web\index.php(16): yii\base\Application->run()
#21 {main}
Yii2 can't escape parameters automatic ? Do I have to do it menualy ?
thanks.
Assuming you are looking for it's
You hava a wrong quote sequence
try using escape for inner quotes
SELECT COUNT(*) FROM `user` `t` WHERE id in (SELECT user_id
from user_profile
WHERE nickname like '%it\'s%' )
or use double quote fo like
SELECT COUNT(*) FROM `user` `t` WHERE id in (SELECT user_id
from user_profile
WHERE nickname like ("%it's%" )

Magento error : SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded;

i have the following problem and i dont know how to solve it. Frontend and Backend dont work. Has anyone an idear ?
a:5:{i:0;s:458:"SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction, query was: UPDATE `catalogrule` SET `name` = ?, `description` = ?, `from_date` = ?, `to_date` = '2017-07-30', `is_active` = ?, `conditions_serialized` = ?, `actions_serialized` = ?, `stop_rules_processing` = ?, `sort_order` = ?, `simple_action` = ?, `discount_amount` = ?, `sub_is_enable` = ?, `sub_simple_action` = ?, `sub_discount_amount` = ? WHERE (rule_id='17')";i:1;s:3033:"#0 /is/htdocs/wp1158418_XAIH5ALR0L/www/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /is/htdocs/wp1158418_XAIH5ALR0L/www/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /is/htdocs/wp1158418_XAIH5ALR0L/www/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /is/htdocs/wp1158418_XAIH5ALR0L/www/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('UPDATE `catalog...', Array)
#4 /is/htdocs/wp1158418_XAIH5ALR0L/www/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('UPDATE `catalog...', Array)
#5 /is/htdocs/wp1158418_XAIH5ALR0L/www/lib/Zend/Db/Adapter/Abstract.php(635): Varien_Db_Adapter_Pdo_Mysql->query('UPDATE `catalog...', Array)
#6 /is/htdocs/wp1158418_XAIH5ALR0L/www/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(433): Zend_Db_Adapter_Abstract->update('catalogrule', Array, 'rule_id='17'')
#7 /is/htdocs/wp1158418_XAIH5ALR0L/www/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_CatalogRule_Model_Rule))
#8 /is/htdocs/wp1158418_XAIH5ALR0L/www/app/code/local/Mirasvit/Action/Model/Observer.php(51): Mage_Core_Model_Abstract->save()
#9 /is/htdocs/wp1158418_XAIH5ALR0L/www/app/code/local/Mirasvit/Action/Model/Observer.php(24): Mirasvit_Action_Model_Observer->updateStatus()
#10 /is/htdocs/wp1158418_XAIH5ALR0L/www/app/code/core/Mage/Core/Model/App.php(1357): Mirasvit_Action_Model_Observer->onControllerActionLayoutRenderBefore(Object(Varien_Event_Observer))
#11 /is/htdocs/wp1158418_XAIH5ALR0L/www/app/code/core/Mage/Core/Model/App.php(1336): Mage_Core_Model_App->_callObserverMethod(Object(Mirasvit_Action_Model_Observer), 'onControllerAct...', Object(Varien_Event_Observer))
#12 /is/htdocs/wp1158418_XAIH5ALR0L/www/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('controller_acti...', Array)
#13 /is/htdocs/wp1158418_XAIH5ALR0L/www/app/code/core/Mage/Core/Controller/Varien/Action.php(384): Mage::dispatchEvent('controller_acti...')
#14 /is/htdocs/wp1158418_XAIH5ALR0L/www/app/code/core/Mage/Adminhtml/controllers/IndexController.php(82): Mage_Core_Controller_Varien_Action->renderLayout()
#15 /is/htdocs/wp1158418_XAIH5ALR0L/www/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_IndexController->loginAction()
#16 /is/htdocs/wp1158418_XAIH5ALR0L/www/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('login')
#17 /is/htdocs/wp1158418_XAIH5ALR0L/www/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#18 /is/htdocs/wp1158418_XAIH5ALR0L/www/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#19 /is/htdocs/wp1158418_XAIH5ALR0L/www/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#20 /is/htdocs/wp1158418_XAIH5ALR0L/www/index.php(83): Mage::run('', 'store')
#21 {main}";s:3:"url";s:17:"/index.php/admin/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:5:"admin";}
When externol script is running its apply changes in database for
multiple time, Because of this mysql services is stack. Due to this reason
website stopped working. Then you can changes the innodb lock wait timeout
setting in php.ini file.
innodb_lock_wait_timeout=5000
Delete Cache
Follow below directory,
var/cache
The problem will be resolved.

createCommand ' is appending to query generating Database exception

Below is my query:
\Yii::$app->db->createCommand("INSERT INTO `schoolwall-10` SELECT FROM `schoolwall-50` WHERE ID=149")->execute();
It is giving me Exception (Database Exception) with the following query:
INSERT INTO `schoolwall-10` SELECT FROM `schoolwall-50` WHERE ID=149'
Updated:
<pre>Exception (Database Exception) 'yii\db\Exception' with message 'SQLSTATE[42000]:
Syntax error or access violation: 1064 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 'FROM `schoolwall-50` WHERE ID=149
' at line 1
The SQL being executed was: INSERT INTO `schoolwall-10` SELECT FROM `schoolwall-50` WHERE ID=149&#039
;
in /var/www/html/OroolaGIT/OroolaPhase1/vendor/yiisoft/yii2/db/Schema.php:615
Stack trace:
#0 /var/www/html/OroolaGIT/OroolaPhase1/vendor/yiisoft/yii2/db/Command.php(789): yii\db\Schema->convertException
(Object(PDOException), 'INSERT INTO `sc...')
#1 /var/www/html/OroolaGIT/OroolaPhase1/frontend/models/Wall.php(1317): yii\db\Command->execute()
#2 /var/www/html/OroolaGIT/OroolaPhase1/frontend/models/Wall.php(1245): frontend\models\Wall::saveShareWithCommunities
(Array, Object(frontend\models\SharePopupModal))
#3 /var/www/html/OroolaGIT/OroolaPhase1/frontend/models/SharePopupModal.php(58): frontend\models\Wall
::shareWithPrimarySchoolCommunities(Object(frontend\models\SharePopupModal))
#4 /var/www/html/OroolaGIT/OroolaPhase1/frontend/controllers/WallController.php(3726): frontend\models
\SharePopupModal->saveShareWithCommunities()
#5 [internal function]: frontend\controllers\WallController->actionModalSharePopupSubmit()
#6 /var/www/html/OroolaGIT/OroolaPhase1/vendor/yiisoft/yii2/base/InlineAction.php(55): call_user_func_array
(Array, Array)
#7 /var/www/html/OroolaGIT/OroolaPhase1/vendor/yiisoft/yii2/base/Controller.php(151): yii\base\InlineAction-
>runWithParams(Array)
#8 /var/www/html/OroolaGIT/OroolaPhase1/vendor/yiisoft/yii2/base/Module.php(455): yii\base\Controller-
>runAction('modal-share-pop...', Array)
#9 /var/www/html/OroolaGIT/OroolaPhase1/vendor/yiisoft/yii2/web/Application.php(83): yii\base\Module-
>runAction('wall/modal-shar...', Array)
#10 /var/www/html/OroolaGIT/OroolaPhase1/vendor/yiisoft/yii2/base/Application.php(375): yii\web\Application-
>handleRequest(Object(yii\web\Request))
#11 /var/www/html/OroolaGIT/OroolaPhase1/frontend/web/index.php(18): yii\base\Application->run()
#12 {main}</pre>
Why is &#039 appending to the query? Can anyone please help.
Missing * try adding
\Yii::$app->db->createCommand("INSERT INTO `schoolwall-10`
SELECT * FROM `schoolwall-50` WHERE ID= 149 ;")->execute();

PDO syntax error, SQLSTATE[42000] [duplicate]

This question already has an answer here:
Syntax error due to using a reserved word as a table or column name in MySQL
(1 answer)
Closed 8 years ago.
I'm getting the following error, and I cannot see the issue. Thanks for any help.
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 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 'unique) VALUES ('XX.XXX.XX.X','03/12/2012','XX.XXX.XX.X - 03/12/2012')' at line 1' in /home/content/07/XXX/html/header.php:11 Stack trace: #0 /home/content/07/XXX/html/header.php(11): PDOStatement->execute(Array) #1 /home/content/07/XXX/html/index.php(15): include('/home/content/0...') #2 {main} thrown in /home/content/07/XXX/html/header.php on line 11
$ip = $_SERVER['REMOTE_ADDR'];
$date = date("d/m/Y");
$unique = $ip." - ".$date;
$data = array($ip, $date, $unique, $date);
$STH1 = $DBH->prepare("INSERT INTO uniques (ip, date, unique) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE date = ?");
$STH1->execute($data);
wrap uniquer with backtick since it is a reserved keyword
eg
INSERT INTO uniques (ip, date, `unique`) ...
MySQL Reserved Keyword List