Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Seguinte pessoal, estou com um problema ao tentar atualizar algum registro no meu banco Mysql, toda vez q tento atualizar aparece a seguinte msg:
You have an error in your SQL syntax near '' at line 1
o meu código é esse:
<?phpsession_start();include("conexao.php");if($_SESSION["admin"]=="on"){?><?$conexao = mysql_connect("localhost","banco","senha"); //Faz conexo com o mysql$db = mysql_select_db("editor"); //Seleciona o banco de dados include "editor/fckeditor.php"; //Chama a classe fckeditor $id_select = $_GET['id']; //Recupera a variavel id para fazer o select $id = $_POST['id']; //Recupera a variavel id para fazer o update $titulo = $_POST['titulo']; $editoria = $_POST['editoria']; $resumo = $_POST['resumo']; $texto = $_POST['texto']; $autor = $_POST['autor']; $fonte = $_POST['fonte']; $data = $_POST['data']; $hora = $_POST['hora']; $destaque = $_POST['destaque']; $status = $_POST['status'];if ((isset($_POST['id'])) && ($_POST['titulo']) && ($_POST['editoria']) && ($_POST['resumo']) && ($_POST['texto']) && ($_POST['autor']) && ($_POST['fonte']) && ($_POST['data']) && ($_POST['hora']) && ($_POST['destaque']) && ($_POST['status'])){ //Verifica se a varivel foi postada $sql = "UPDATE news SET titulo = '".$titulo."', editoria = '".$editoria."', resumo = '".$resumo."', texto = '".$texto."', autor = '".$autor."', fonte = '".$fonte."', data = '".$data."', hora = '".$hora."', destaque = '".$destaque."', status = '".$status."' where id = '".$id."';"; //Faz a alterao do registro $result = mysql_query($sql) or die(mysql_error()); //Verifica se os registros foram alterados header("Location: ver.php"); //Aps inserido redireciona para a pgina ver.php }$sql_texto = "SELECT * FROM news where id=$id_select";$query_texto = mysql_query($sql_texto) or die(mysql_error());$row_texto = mysql_fetch_assoc($query_texto);$id = $row_texto['id'];$titulo = $row_texto['titulo'];$editoria = $row_texto['editoria'];$resumo = $row_texto['resumo'];$texto = $row_texto['texto'];$autor = $row_texto['autor'];$fonte = $row_texto['fonte'];$data = $row_texto['data'];$hora = $row_texto['hora'];$destaque = $row_texto['destaque'];$status = $row_texto['status'];?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "[http://www.w3.org/TR/html4/loose.dtd">http-equiv=Content-Type content="text/html; charset=UTF-8"><!-- Caminho do arquivo js do FCK Editor--><script type="text/javascript" src="editor/fckeditor.js"></script><link href="../estilo.css" rel="stylesheet" type="text/css"><title>Sistema de Inserção de Notícias PHP / MySql Léo César - Cliente: RONDONIA IN FOCO</title></head><body><div style="background-color:#FFFFFF; padding:4px;"> <div align="center" class="TITULO"><a href="inserir.php" class="TITULO">INSERIR</a> - <a href="registros.php" class="TITULO">EDITAR</a> - <a href="#" class="TITULO">EVENTOS</a> - <a href="logout.php" class="TITULO">SAIR</a></div></div><br><table width="750" border="0" align="center" cellpadding="4" cellspacing="0" style="border:1px #000000 dashed; background-color:#FFFFFF;"> <tr> <td><form method="post" name="form" action="<?=$_SERVER['PHP_SELF']?>"><table width="750" border="0" cellspacing="2" cellpadding="2"> <tr> <td width="70" class="PEQUENO_B" style="border:1px #000000 dashed;">Título:</td> <td width="666" style="border:1px #000000 dashed;"><input name="titulo" type="text" class="form" value="<?php echo "$titulo"; ?>" size="120"></td> </tr> <tr> <td class="PEQUENO_B" style="border:1px #000000 dashed;">Editoria:</td> <td style="border:1px #000000 dashed;"><input name="editoria" type="text" class="form" id="editoria" value="<?php echo "$editoria"; ?>"></td> </tr> <tr> <td class="PEQUENO_B" style="border:1px #000000 dashed;">Resumo:</td> <td style="border:1px #000000 dashed;"><textarea name="editoria" cols="80" rows="10" class="form" id="editoria"><?php echo "$resumo"; ?></textarea></td> </tr> <tr> <td class="PEQUENO_B" style="border:1px #000000 dashed;">Texto:</td> <td style="border:1px #000000 dashed;"><? $editor = new FCKeditor("texto"); //Nomeia a rea de texto$editor-> BasePath = "/editor/editor/"; //Informa a pasta do FKC Editor$editor-> Value = "$texto"; //Informa o texto a ser alterado $editor-> Width = "100%"; //informa a largura do editor $editor-> Height = "450"; //informa a altura do editor$editor-> Create(); // Cria o editor ?></td> </tr> <tr> <td class="PEQUENO_B" style="border:1px #000000 dashed;">Autor:</td> <td style="border:1px #000000 dashed;"><input name="autor" type="text" class="form" id="autor" value="<?php echo "$autor"; ?>" size="30"></td> </tr> <tr> <td class="PEQUENO_B" style="border:1px #000000 dashed;">Fonte:</td> <td style="border:1px #000000 dashed;"><input name="fonte" type="text" class="form" id="fonte" value="<?php echo "$fonte"; ?>" size="30"></td> </tr> <tr> <td class="PEQUENO_B" style="border:1px #000000 dashed;">Data:</td> <td style="border:1px #000000 dashed;"><input name="data" type="text" class="form" id="data" value="<?php echo "$data"; ?>"> <input name="hora" type="text" class="form" id="hora" value="<?php echo "$hora"; ?>"></td> </tr> <tr> <td class="PEQUENO_B" style="border:1px #000000 dashed;">Destaque:</td> <td style="border:1px #000000 dashed;"><input name="destaque" type="text" class="form" id="destaque" value="<?php echo "$destaque"; ?>"></td> </tr> <tr> <td class="PEQUENO_B" style="border:1px #000000 dashed;">Status:</td> <td style="border:1px #000000 dashed;"><input name="status" type="text" class="form" id="status" value="<?php echo "$status"; ?>"></td> </tr> <tr> <td style="border:1px #000000 dashed;"><input type="hidden" name="id" value="<?php echo "$id"; ?>"></td> <td style="border:1px #000000 dashed;"><input type="submit" value="Alterar"> </td> </tr></table></form></td> </tr></table><br><div style="background-color:#FFFFFF; padding:4px;"> <div align="center" class="PEQUENO">Desenvolvido por <a href="mailto:bossal@gmail.com" class="PEQUENO_B">Léo César</a><br></div></div></body></html><?php}else{echo "<script>location.href='login.htm'</script>";}?>
alguém sabe oq pode estar acontecendo?
Carregando comentários...