Php 执行查询时出错
我试图通过一个弹出窗口更新我的网站内容。我让内容根据ID显示,但当我尝试提交时,弹出窗口上会出现错误 执行查询时出错。 请将此错误通知web开发人员 注意:您的SQL语法有错误;检查手册 对应于您的MySQL服务器版本,以便使用正确的语法 在第1行的“WHERE textID=16”附近 而且我似乎找不到窃听器。你能看见吗 以下是我的完整代码:Php 执行查询时出错,php,mysql,sql-update,Php,Mysql,Sql Update,我试图通过一个弹出窗口更新我的网站内容。我让内容根据ID显示,但当我尝试提交时,弹出窗口上会出现错误 执行查询时出错。 请将此错误通知web开发人员 注意:您的SQL语法有错误;检查手册 对应于您的MySQL服务器版本,以便使用正确的语法 在第1行的“WHERE textID=16”附近 而且我似乎找不到窃听器。你能看见吗 以下是我的完整代码: <!-- PHP --> <? include('global.php'); if(isset($_REQU
<!-- PHP -->
<?
include('global.php');
if(isset($_REQUEST['textID']))
$textID = $_REQUEST['textID'];
if(isset($_REQUEST['textContent']))
$textContent = $_REQUEST['textContent'];
if($_POST){
$query = "UPDATE text_tb SET ";
$query = $query."textContent='".$textContent."', ";
$query = $query."WHERE textID=".$textID."";
//echo $query;
ExecuteQuery($query);
echo "<script type=\"text/javascript\">
<!--
window.close();
//-->
</script>";
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Full featured example</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- TinyMCE -->
<script type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
// General options
mode : "textareas",
theme : "advanced",
plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave,visualblocks",
// Theme options
theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "bullist,numlist,|,undo,redo,|,link,unlink,|,forecolor",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : false,
// Example content CSS (should be your site CSS)
content_css : "css/content.css",
// Drop lists for link/image/media/template dialogs
template_external_list_url : "lists/template_list.js",
external_link_list_url : "lists/link_list.js",
external_image_list_url : "lists/image_list.js",
media_external_list_url : "lists/media_list.js",
// Style formats
style_formats : [
{title : 'Bold text', inline : 'b'},
{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
{title : 'Example 1', inline : 'span', classes : 'example1'},
{title : 'Example 2', inline : 'span', classes : 'example2'},
{title : 'Table styles'},
{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
],
});
</script>
<!-- /TinyMCE -->
</head>
<body role="application">
<form method="post" action="<?php $_PHP_SELF ?>">
<div>
<!-- Gets replaced with TinyMCE, remember HTML in a textarea should be encoded -->
<div>
<textarea id="textContent" name="textContent" rows="15" cols="80" style="width: 80%">
<?
$result = mysql_query("SELECT * FROM text_tb WHERE textID ='".$textID."'");
while($row = mysql_fetch_array($result)){
echo $row['textContent'];
}
?>
</textarea>
</div>
<!-- Some integration calls
<a href="javascript:;" onclick="tinyMCE.get('textContent').show();return false;">[Show]</a>
<a href="javascript:;" onclick="tinyMCE.get('textContent').hide();return false;">[Hide]</a>-->
<br />
<input type="submit" name="save" value="Submit" />
<input type="reset" name="reset" value="Reset" />
</div>
</form>
<!--<script type="text/javascript">
if (document.location.protocol == 'file:') {
alert("The examples might not work properly on the local file system due to security settings in your browser. Please use a real webserver.");
}
</script>-->
</body>
</html>
全功能示例
tinyMCE.init({
//一般选择
模式:“文本区域”,
主题:“高级”,
插件:“自动链接、列表、分页符、样式、图层、表格、保存、advhr、advimage、advlink、emotions、iespell、inlinepopups、insertdatetime、预览、媒体、搜索替换、打印、上下文菜单、粘贴、方向性、全屏、不可编辑、可视光标、不可中断、xhtmlxtras、模板、字数、advlist、自动保存、可视块”,
//主题选项
主题高级按钮1:“新建文档,|,粗体,斜体,下划线,删除线,|,左对齐,居中对齐,右对齐,全对齐,样式选择,字体选择,字体大小选择”,
主题_高级_按钮2:“bullist,numlist,|,undo,redo,|,link,unlink,|,forecolor”,
主题\高级\工具栏\位置:“顶部”,
主题\高级\工具栏\对齐:“左”,
主题\高级\状态栏\位置:“底部”,
主题\u高级\u大小调整:错误,
//示例内容CSS(应该是您的网站CSS)
content\u css:“css/content.css”,
//链接/图像/媒体/模板对话框的下拉列表
template\u external\u list\u url:“lists/template\u list.js”,
外部链接列表url:“lists/link\u list.js”,
外部图片列表url:“lists/image\u list.js”,
媒体\u外部\u列表\u url:“lists/media\u list.js”,
//样式格式
样式和格式:[
{标题:“粗体文本”,内联:“b'},
{标题:'Red text',内联:'span',样式:{color:'#ff0000'}},
{title:'Red header',block:'h1',style:{color:'#ff0000'}},
{title:'example1',inline:'span',classes:'example1'},
{title:'example2',inline:'span',classes:'example2'},
{title:'表格样式'},
{title:'Table row 1',选择器:'tr',类:'tablerow 1'}
],
});
问题在于集合末尾的逗号。更改此行:
$query = $query."textContent='".$textContent."', ";
致:
当心,我犯了一点小错误。谢谢!
$query = $query."textContent='".$textContent."' ";