怎样把变量写入sql? 这样可以的。$query = "INSERT INTO 'note' ('id','content') VALUES ('',".$last.")"; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 对$last加上单引号,即 '$last' 就可以了。我在MySQL上试过,不知你这里怎么样,就是这个同样的情况,用insert语句。 如果你的那个content是数值型的就不用那个‘如果不是你加上就可以用了。$query = "INSERT INTO 'note' ('id','content') VALUES ('','$last')"; 那就这样。$query = "INSERT INTO 'note' ('id','content') VALUES ('','$last')";$query = "INSERT INTO 'note' ('id','content') VALUES ('','".$last."')";不行就看看是不是有不可为空的字段你没有给值。 我的content是text型的。我最后把那个id和content删掉,即:$query = "INSERT INTO 'note' VALUES ('','$last')";即可了。谢谢。 $query = "INSERT INTO note (id, content) VALUES ('','$last')";就可以了,字段名是不能加引号的 $query = "INSERT INTO 'note' ('id','content') VALUES ('','".$last."')";如果$last中出现'怎么办?不知道可以实现否$query = "INSERT INTO note (id, content) VALUES ('','$last')";如果可以的话,最好采用它 post怎么传值比较安全 大家觉得做一个php站得多少钱? 现在主流的PHP的开发工具是什么? 几个正则表达式 php输出xml 为什么输出的小时数不对 如何在页面传递数组?高手请指点,在线等,急!!! 关于提取相同信息代码记录的问题 radio这样的功能怎么实现!在线急等中。。。。 error 2003:Can't connect to MySQL server on 'localhost'(10061)???? 请问为什么下面这句写入sql没反应? 如何分割这个字符串?在线等。。。。
$query = "INSERT INTO 'note' ('id','content') VALUES ('','$last')";$query = "INSERT INTO 'note' ('id','content') VALUES ('','".$last."')";不行就看看是不是有不可为空的字段你没有给值。
我最后把那个id和content删掉,即:$query = "INSERT INTO 'note' VALUES ('','$last')";
即可了。谢谢。
就可以了,字段名是不能加引号的
$query = "INSERT INTO note (id, content) VALUES ('','$last')";如果可以的话,最好采用它