insert-php+mysql中插入語句,時間前面為什麼要有空格

來源:互聯網
上載者:User
關鍵字 insert php mysqli
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

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

  • IndexesInformationSpace usageData16KiBIndex0BTotal16KiBRow statisticsFormatCompactCollationutf8_general_ciNext autoindex2CreationApr 18, 2015 at 10:51 AM

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前面為什麼必須要有空格?

  • 相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.