insertphpmysqli
数据表如下:
#
Name
Type
Collation
Attributes
Null
Default
Extra
Action
1
id
int(10)
UNSIGNED
No
None
AUTO_INCREMENT
Change
Drop
More
2
author
char(20)
utf8_general_ci
立即学习“PHP免费学习笔记(深入)”;
No
None
Change
Drop
More
3
addtime
datetime
No
None
Change
Drop
More
4
content
varchar(100)
utf8_general_ci
No
None
Change
Drop
More
5
reply
varchar(100)
utf8_general_ci
No
None
Change
Drop
More
Check AllWith selected: Browse Change Drop Primary Unique Index
Print view Relation view Propose table structure Move columns
Add column(s) At End of Table At Beginning of Table Afteridauthor addtimecontentreply
1.只写入时间。
$sql = "INSERT INTO message(addtime,) VALUES ('2015-04-22 08:33:46')";
可以写入,结果如下:
id
主键,自动增长
author
作者
addtime
留言时间
content
留言内容
reply
回复
Edit
Copy
Delete
1
2015-04-22 08:33:46
2.按照表单填写留言。
$sql="INSERT INTO message(author, addtime, content) VALUES ('$name','$addtime','$content')";
可以正常写入,让我困惑的是addtime中的addtime前面为什么必须要有空格?
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号