通过php mysql更新表
16lz
2021-01-22
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.
这段代码错误的东西很难枚举。但是,至少应该在查询之前建立与数据库的连接。
更多相关文章
- MySQL-数据库安装及基本SQL语句
- 在代码点火器中从mysql迁移到postgresql
- 【动软.Net代码生成器】连接MySQL生成C#的POCO实体类(Model)
- 8.2.1.2-MySQL如何优化 WHERE 语句
- ORACLE 分页SQL语句
- MYSQL查询语句:排名在第3名的成绩是多少?
- MYSQL中update语句 与in 的bug
- MySQL SQL语句学习(查询某年每个月的销售额与采购额)
- 简单的插入语句不能在PHP代码中工作。适用于MySQL Workbench