无法理解mysql错误:
UPDATE static_pages SET order ="一些新数据222222
"数据库错误:您的SQL语法中有错误;请查看与您的MySQL服务器版本对应的手册,以便在'order ='附近使用正确的语法
$query = 'UPDATE someTable SET '.$key.' = "'.$value.'"';
Run Code Online (Sandbox Code Playgroud)
这是$ key = order; $ value ='新数据222222'; 表中有这样的键:订单,价格,联系方式.除"订单"外,其中每个都更新.为什么?
我无法弄清楚是什么导致我的INSERT INTO失败到MySql中的某个表.我可以将它们管理到其他表格.该表看起来像:
CREATE TABLE IF NOT EXISTS `Match` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`match_no` int(11) NOT NULL,
`season` int(11) NOT NULL,
`hometeam` int(11) NOT NULL,
`awayteam` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `match_no` (`match_no`),
KEY `season` (`season`),
KEY `hometeam` (`hometeam`),
KEY `awayteam` (`awayteam`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
Run Code Online (Sandbox Code Playgroud)
命令是
INSERT INTO Match (`match_no`, `season`, `hometeam`, `awaytem`) VALUES (1, 1, 2, 3)
Run Code Online (Sandbox Code Playgroud)
我得到的只是:
1064 - 您的SQL语法出错; 检查对应于你的MySQL服务器版本使用附近的正确语法手册"匹配(match_no,season,hometeam,awaytem)VALUES(1,1,2,3)"在1号线
我已经检查了手册和网上的六个例子以及什么,并尝试对语法进行各种更改,以防有一些特定的MySql奇怪,但似乎没有任何效果.
我需要做以下选择:
select distinct type as option from pages
Run Code Online (Sandbox Code Playgroud)
但我不断收到错误.你能帮我吗?
这段代码有问题吗?我正在运行MYSQL 5我一直收到此错误:
您的SQL语法有错误; 查看与您的MySQL
服务器版本对应的手册,以便在'desc BLOB附近使用正确的语法,查看BLOB,url BLOB)'
这是我的查询:
mysql_query("CREATE TABLE videos(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
title VARCHAR(50),
desc BLOB,
review BLOB,
url BLOB
)
") or die(mysql_error());
Run Code Online (Sandbox Code Playgroud)
它看起来不错.起初我以为它是"BLOB"数据类型,但后来我尝试了"TEXT",它仍然搞砸了,所以我不太确定.
所以我有这个,
<?php
require "database.php";
$to=$_GET['toF'];
$content=$_POST['message_contentl'];
$from=$_GET['fromF'];
$ck_reciever = "SELECT Username FROM accounts WHERE username = '".$to."'";
if( mysql_num_rows( mysql_query( $ck_reciever ) ) == 0 ){
die("The user you are trying to contact don't exist. Please go back and try again.<br>
<form name=\"back\" action=\"Send_FR.php\" method=\"post\">
<input type=\"submit\" value=\"Try Again\">
</form>
");
}else{
$a1 = $_POST['message_contentl'];
$a2 = $_GET['fromF'];
$a3 = $_GET['toF'];
mysql_query("INSERT INTO Friends (fr_message, From, To) VALUES ('$a1', '$a2', '$a3')"); OR die("Could not send the message: <br>".mysql_error());
echo "The …Run Code Online (Sandbox Code Playgroud) 我不断收到以下SQL语法错误:
错误信息
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 'desc, tag ) VALUES( '1', '1', '1', 'Jakis pis', 'Jakis tag')' at line 1Query failed
MYSQL QUERY:
$qry = "INSERT INTO lang".$lang." ( lang, submenu, live, desc, tag ) VALUES( '$lang', '$submenu', '$live', '$desc', '$tag') ";
的print_r($ QRY);
完整的SQL查询: INSERT INTO lang1 ( lang, submenu, live, desc, tag ) VALUES( '1', '1', '1', …
当我尝试运行此脚本时,如果我删除或更改名称,我会在"范围"收到错误,但是应用程序需要此列来存储数据.知道如何将其插入MySQL吗?
错误代码:1064.您的SQL语法有错误; 检查与MySQL服务器版本对应的手册,以便在"范围"附近使用正确的语法CHAR(5)NOT NULL,range_max_value NUMERIC(18,3)'在第22行
CREATE TABLE My_table (
chart_id INTEGER NOT NULL,
u_range CHAR(5),
l_range CHAR(5),
"range" CHAR(5) NOT NULL,
range_max_val NUMERIC(18,3),
range_min_val NUMERIC(18,3),
PRIMARY KEY (chart_id)
);
Run Code Online (Sandbox Code Playgroud) 我在以下代码上遇到MySQL语法错误:
$addcompany = mysql_query("INSERT INTO company (method, category, email, password,
companyname, phone, address, state, zip, ratingcount, ratingscore, usage, date)
VALUES ('$method','$category','$email','$temp_encrypted_password',
'$companyname','$phone','$address','$state','$zip','0','0','0',CURDATE()) ")
or die(mysql_error());
Run Code Online (Sandbox Code Playgroud)
声明就此消失了.MySQL错误告诉我:
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 'usage, date) VALUES
('referral','referral','email@gmail.com','d90ccafeea7983' at line 1
Run Code Online (Sandbox Code Playgroud)
我检查了我的表,所有的列名都是正确的,似乎与我试图插入的内容和允许输入到列中的内容没有任何冲突.
所以我在这一点上非常恼火,我无法弄清楚什么是一个简单的错误.很生气,希望有人在这里可以快速指出我的权利.
谢谢你的时间
我已经尝试过以下各种其他声明,但认为其中之一显然应该有效,但到目前为止还没有运气。请告诉我我做错了什么。没有收到错误,它只是不起作用。
DELETE FROM table_name WHERE from < NOW()DELETE FROM table_name WHERE from < '2022-04-16 08:00:00'
例子 好的,我已经使用PHP + MySQL了一段时间,所以我认为自己很精通.我过去在语法错误方面做了很多,但老实说这让我感到沮丧:
http://img251.imageshack.us/img251/3760/fubar.png
如果有人能告诉我为什么这个简单的陈述不起作用,我将非常感激.