[英]How to run MySQL Query which has multiple lines in PHP?
如何在PHP中運行如下查詢:
INSERT INTO table VALUES ('example name', 'thisisfirstline
thisissecondline
thisisthirdline')
我已將文字設置為文本。
當我與Navicat一起運行時,我一點都沒有問題。 我嘗試在PHP中運行它:
mysql_query("INSERT INTO table VALUES ('example name', 'thisisfirstline
thisissecondline
thisisthirdline')
OR die('ERROR');
輸出以下內容:
thisisfirstlinethisissecondlinethisisthirdline
如何插入值而不將其全部粘貼在一起?
將\\n
用於在MySQL表中插入換行符:
INSERT INTO table VALUES ('example name', 'thisisfirstline\n
thisissecondline\n
thisisthirdline')
將類型設置為varchar
而不是表中的text
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.