mysql插入报错问题
INSERT INTO `Sale_Order` (`id`,`number`,`order_id`, `order_status`, `buyer_name`, `buyer_email`, `buyer_phone_number
`, `total_price`, `currency`, `phone`, `postal_code`, `recipient_name`, `ship_address`, `ship_state`
, `city`, `country`, `account`, `lastup_date`, `payments_date`, `delivery_date`, `download_date`, `delivery_warehouse
`) VALUES (NULL,'1','249-4503994-1570232','2','杉本 圭\','jc3mwnzmvtcqgpg@marketplace.amazon.co.jp','','1000
.00','JPY','','225-0003','ロ?ソ\ンL たまプラ?ザ?南口','横浜市青?区新石川3?15?2 ','神奈川?','--','JP','JP_John','','2015-03-27T20
:43:50+09:00','',NOW(),'FBA')
以上报错
#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 'jc3mwnzmvtcqgpg@marketplace.amazon.co.jp','','1000 .00','JPY','','225-0003','ã?' at line 2
插入之前都转了UTF-8的,请问这里面,哪有问题??
回复讨论(解决方案)
'杉本 圭\' 看到了么,你的单撇号被转义了。因此会报语法错误。
如果是外部插入的,那么很可能是因为你根本没有过滤和转义得到的参数。
请问怎么过滤掉这些导致插入失败的字符啊?
可以在插入之前就是用函数进行转义,有个php函数叫
addslashes()?
先用mysql_real_escape_string做一次转义
$name = mysql_real_escape_string($name);$sqlstr = "insert into table(`name`) values('".$name."')";

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Alipay PHP...

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

Article discusses essential security features in frameworks to protect against vulnerabilities, including input validation, authentication, and regular updates.

The article discusses adding custom functionality to frameworks, focusing on understanding architecture, identifying extension points, and best practices for integration and debugging.
