如何通过textaera在mysql中插入c程序 [英] how insert a c programs in mysql through a textaera

查看:65
本文介绍了如何通过textaera在mysql中插入c程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过textaera在数据库中插入一个c程序.我在php中制作页面.当我们插入一个简单的文本时,它将成功插入,但是当我们插入一个完整的程序时,它将给ex错误.当我们插入一行时
if(arr [0] ==''0'')

那么错误就来了-您的SQL语法有错误;请在第1行的
上查看与您的MySQL服务器版本相对应的手册,以在``0''),now());附近使用正确的语法"
而我在php中的sql查询是-插入cprograms值(0,''$ textaera'',now());

在这里,我们编写的cprogram在变量$ textaera
中可用

此处仅在引号字符中出现错误,而在字符串中存在引号时,则会产生错误,因此请告诉我我们如何插入包含引号的单词,无论是单引号还是双引号
请帮助我.

解决方案

textaera'',now());

在这里,我们写的我的程序在变量中可用


textaera


此处仅在引号字符中出现错误,而在字符串中存在引号时,则会产生错误,因此请告诉我我们如何插入包含引号的单词,无论是单引号还是双引号
请帮助我.


在数据库中插入时必须转义引号(''),例如,参见 [
and my sql query in php is - "insert into cprograms values (0,''$textaera'',now())";

here my cprogram which we wriiten is available in variable $textaera


here error only in quotes character when there is quote in string then it will give a error so tell me how can we insert a word which include a quotes whether there is single quote or double quotes
please help me .

解决方案

textaera'',now())";

here my cprogram which we wriiten is available in variable


textaera


here error only in quotes character when there is quote in string then it will give a error so tell me how can we insert a word which include a quotes whether there is single quote or double quotes
please help me .


You have to escape the quote ('') character when inserting in the database, see, for instance, "The Competitors"[^].


这篇关于如何通过textaera在mysql中插入c程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆