1 頁 (共 1 頁)

[問題]sql 問題

發表於 : 2003-08-20 14:42
楓兒
我想 update 一個field , 佢係 varchar type.

$newposition = 'yyy';

$sql = "update x_table set newposition = $newposition ";

結果就係唔得

但我

$sql = "update x_table set newposition = 'xxx' ";
就無問題, 請問點解 一用variable 就死呢?

發表於 : 2003-08-21 05:35
Mac
可以用普通話嗎?看不懂香港用語

~Mac

Re: [問題]sql 問題

發表於 : 2003-08-21 06:36
ethan
楓兒 寫:我想 update 一個field , 佢係 varchar type.

$newposition = 'yyy';

$sql = "update x_table set newposition = $newposition ";

結果就係唔得

但我

$sql = "update x_table set newposition = 'xxx' ";
就無問題, 請問點解 一用variable 就死呢?
$sql = "update x_table set newposition = '$newposition' ";

字串應該用引號括起來,就是這個原因