字串要使用( ' ' ) 或是(" ") 框起來。
<?php
print "文字字串";
print '第二行文字';
?>
雖然用( ' ' ) 或是(" ") 將字串框起來都是可以的,但在框住變數的時候,就會產生差異了。
<?php
$a = "hi 中文";
print "$a";
print '$a';
?>
要用php來發佈SQL語法,在這情況下,就要把SQL語法當作字串。
mysql_query('insert into member value('人名',.....)');
用( ' ( ' ' ) ' )就會產生錯誤
為了將' '當成字串,而在最外面用雙引號" "框住。
mysql_query("insert into member value('人名',.....));
用( "( ' ' ) " )就會OK