douyuepi6485 2014-01-09 13:59
浏览 6

如何使用textarea更新日期

Need some help here. I am trying to update my date in my database using textarea. At first, I get the date from my database and post it in the textarea. But now I am trying to change the date by editing the date in the text area.

Here is my query.

$sql=mysqli_query($con,"UPDATE tblevent SET title='".$_POST['title']."' , 
eventdate='".$_POST['datee']."' body='".$_POST['body']."' , 
timestart='".$_POST['begtime']."' , timeend='".$_POST['endtime']."' WHERE 
eventid='".$_POST['id']."'" ) or mysqli_error(die($con));

eventdate='".$_POST['datee']."' is always getting an error

"Catchable fatal error: Object of class mysqli could not be converted to string"

here is my textarea

<?php echo "Date: <textarea name='datee' rows=1 cols=25>".$rows['eventdate']."</textarea>"; ?>
  • 写回答

1条回答 默认 最新

  • duancuo1234 2014-01-09 15:29
    关注

    You have missed a comma in this line

    eventdate='".$_POST['datee']."' body='".$_POST['body']."'
    

    it should be,

    eventdate='".$_POST['datee']."', body='".$_POST['body']."'

    Furthermore its better to use mysql_escape_string() for each user input to avoid sql injection, rather than directly concatenating POST variables to SQL query string.

    评论

报告相同问题?

悬赏问题

  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计