我正在尝试执行一个简单的MySQL查询,如下所示:
INSERT INTO user_details (username, location, key)
VALUES ('Tim', 'Florida', 42)
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误:
错误1064(42000):您的SQL语法有错误; 检查与MySQL服务器版本对应的手册,以便
'key) VALUES ('Tim', 'Florida', 42)'
在第1行附近使用正确的语法
我该如何解决这个问题?
我正在使用 Laravel 5.5 我添加了这个依赖项来制作简单的搜索引擎
https://github.com/nicolaslopezj/searchable
但是当我尝试搜索任何东西时遇到问题
SQLSTATE[42000]: Syntax error or access violation: 1055 'myreview.movies.name' isn't in GROUP BY (SQL: select count() as aggregate from (select movies., max((case when LOWER(movies.name) LIKE car then 150 else 0 end) + (case when LOWER(movies.name) LIKE car% then 50 else 0 end) + (case when LOWER(movies.name) LIKE %car% then 10 else 0 end) + (case when LOWER(movies.description) LIKE car then 150 else 0 end) + (case when LOWER(movies.description) LIKE car% then 50 else 0 end) …
我有这一点SQL
总是返回一个错误,但我找不到为什么它返回错误.我已连接到数据库,没有错误.我跑PHP 5.2.17
,MySQL 5.5.25a
和Apache 2.4.2.
的SQL
:
DELETE FROM mail WHERE to=1
Run Code Online (Sandbox Code Playgroud)
错误:
您的SQL语法有错误; 检查与MySQL服务器版本对应的手册,以便在第1行的'to = 1'附近使用正确的语法
我在 CakePHP 3.0 中面临使用 Form 将数据保存到数据库的问题。
//add.ctp
<div>
<?= $this->Form->create($deposit) ?>
<fieldset>
<legend><?= __('Add') ?></legend>
<?php
echo $this->Form->input('date');
echo $this->Form->input('profile_id', ['options' => $profiles]);
echo $this->Form->input('amnt');
echo $this->Form->input('desc');
echo $this->Form->input('user_id', ['options' => $users]);
?>
</fieldset>
<?= $this->Form->button(__('Submit')) ?>
<?= $this->Form->end() ?>
</div>
Run Code Online (Sandbox Code Playgroud)
这是我的添加功能
public function add()
{
$deposit = $this->Deposits->newEntity();
if ($this->request->is('post')) {
$deposit = $this->Deposits->patchEntity($deposit, $this->request->data);
if ($this->Deposits->save($deposit)) {
$this->Flash->success(__('The member deposit has been saved.'));
return $this->redirect(['action' => 'index']);
} else {
$this->Flash->error(__('The member deposit could not be saved. Please, …
Run Code Online (Sandbox Code Playgroud)