我试图更新我的表('ptb_messages')中的一列('content'),其中消息的'id'与提交时在我的表单中回显的相同,因此 WHERE id='".$message_id。 " 这是一个全局函数集。消息的 id 被很好地回显,问题出在函数或 mysql 脚本中。
有人可以告诉我我哪里出了问题。谢谢
html表单:
<form id="reply" action="message_reply.php?to=<?php echo "".$message_id.""; ?>" method="post">
<textarea name="textarea" id="textarea"><?php echo "{$message['content']}"; ?></textarea>
<?php
}
?>
<input type="image" src="assets/img/icons/email_send.png"
width="50" height="34" name="send_button" id="send_button">
</form>
mysql function:
<?php
require_once("includes/session.php");
require_once("includes/functions.php");
require('includes/_config/connection.php');
?>
<?php
session_start();
include 'includes/_config/connection.php';
$textarea = $_POST['textarea'];
$result = mysql_query("SELECT content FROM ptb_messages WHERE id='".$message_id."'");
if(!$result)
{
echo "The username you entered does not exist";
}
else
if($textarea!= mysql_result($result, 0))
{
echo "";
$sql=mysql_query("UPDATE ptb_messages SET content ='".addslashes($textarea)."' WHERE id='".$message_id."'");
}
if($sql)
{
}
header("Location: {$_SERVER['HTTP_REFERER']}");
?>
我收到这些错误:
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 9 in /Applications/XAMPP/xamppfiles/htdocs/ptb1/message_reply.php on line 25
Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/ptb1/message_reply.php:25) in /Applications/XAMPP/xamppfiles/htdocs/ptb1/message_reply.php on line 37