This is my code to update a table. My problem is that after submitting a fresh record I'm unable to update the first time (it shows blank), but the second time it works fine.

这是我更新表的代码。我的问题是,提交新记录后,我无法第一次更新(显示空白),但第二次工作正常。

One more thing: when I remove the include statement then it is working fine on submessage.php there is no any phpcode. [annakata: I have no idea what this means]

还有一件事:当我删除include语句时,它在submessage.php上运行正常,没有任何phpcode。 [annakata:我不知道这意味着什么]

$pid = $_GET['id'];
$title = $_POST['title'];
$summary = $_POST['summary'];
$content = $_POST['content'];
$catid = $_POST['cid'];
$author = $_POST['author'];
$keyword = $_POST['keyword'];
$result1= mysql_query("update listing set catid='$catid',title='$title',
summary='$summary',content='$content', author='$author', keyword='$keyword' where pid='$pid'",$db);
    include("submessage.php");

3 个解决方案

#1


The things that are wrong with that piece of code are hard to enumerate. However, at the very least, you should establish a connection to the database before you can query it.

这段代码错误的东西很难枚举。但是,至少应该在查询之前建立与数据库的连接。

更多相关文章

  1. MySQL-数据库安装及基本SQL语句
  2. 在代码点火器中从mysql迁移到postgresql
  3. 【动软.Net代码生成器】连接MySQL生成C#的POCO实体类(Model)
  4. 8.2.1.2-MySQL如何优化 WHERE 语句
  5. ORACLE 分页SQL语句
  6. MYSQL查询语句:排名在第3名的成绩是多少?
  7. MYSQL中update语句 与in 的bug
  8. MySQL SQL语句学习(查询某年每个月的销售额与采购额)
  9. 简单的插入语句不能在PHP代码中工作。适用于MySQL Workbench

随机推荐

  1. Android之不要滥用SharedPreferences
  2. 解决Android sdk更新不能下载或下载内容
  3. Android layout常见的属性大全
  4. 老罗Android开发视频教程 (android常用布
  5. 让Python在Android系统上飞一会儿
  6. Androidの自定义Spinner实现
  7. 【Android Studio使用教程4】Android Stu
  8. 修改android升级系统后启动系统,提示andro
  9. Android TextView 设置行间距字间距
  10. Android 入门前言之 --布局