当前位置:网站首页>SQL statement error of common bug caused by Excel cell content that is not paid attention to for a long time
SQL statement error of common bug caused by Excel cell content that is not paid attention to for a long time
2022-07-03 08:46:00 【The luckier~】
bug------ Strange index value generation ( Solution :addslashes)
Preface :bug------ Strange index value generation ( Solution :addslashes)
When the code is running BUG
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 ‘04643945’’ at line 1
error SQL:select * from book where 1=1 and book_id=’‘04643945’
Here are some Inline code slice .
// Display the error code
$result = 'select * from book where 1=1 and book_id=\'' .$datahtml[$i]['nuid'] .'\'';
// Show corrections
$result = 'select * from book where 1=1 and book_id=\'' .addslashes($datahtml[$i]['nuid']) .'\'';
From the above code, we can see that we have added one more PHP function :
The action point of the function can be linked .(https://www.w3school.com.cn/php/func_string_addslashes.asp)
addslashes() Function returns a string with a backslash before a predefined character .
The reason for the error :’‘04643945’
Cause of error : When EXCEL When the number in is text , When importing or copying select all , With single quotation marks on it


边栏推荐
- Unity notes 1
- [concurrent programming] thread foundation and sharing between threads
- Find the intersection of line segments
- Unity Editor Extension - Outline
- Mysql容器化(1)Docker安装MySQL
- 【Rust笔记】02-所有权
- Intersectionpicker in osgearth
- Cloudcompare learning (1) - cloudcompare compilation and common plug-in implementation
- 【Rust 笔记】09-特型与泛型
- Animation_ IK overview
猜你喜欢

Monotonic stack -84 The largest rectangle in the histogram

UE4 source code reading_ Bone model and animation system_ Animation node

22-06-28 Xi'an redis (02) persistence mechanism, entry, transaction control, master-slave replication mechanism

Deep parsing (picture and text) JVM garbage collector (II)

【Rust笔记】02-所有权

Cloudcompare learning (1) - cloudcompare compilation and common plug-in implementation

Final review of Database Principles

Servlet的生命周期

22-06-28 西安 redis(02) 持久化机制、入门使用、事务控制、主从复制机制

Installation of PHP FPM software +openresty cache construction
随机推荐
Animation_ IK overview
Vscode, idea, VIM development tool shortcut keys
[linear table] basic operation of bidirectional linked list specify node exchange
Allocation exception Servlet
[updating] wechat applet learning notes_ three
Deeply understand the underlying data structure of MySQL index
[rust notes] 05 error handling
Markdown directory generation
[public key cryptography] ECC elliptic cryptosystem (implementing ElGamal encryption method)
Osgearth starry background
producer consumer problem
22-06-27 Xian redis (01) commands for installing five common data types: redis and redis
[rust note] 10 operator overloading
LinkedList set
[concurrent programming] explicit lock and AQS
First Servlet
Monotonic stack -42 Connect rainwater
UE4 source code reading_ Bone model and animation system_ Animation compression
Osgearth north arrow display
【Rust 笔记】08-枚举与模式