1. 程式人生 > >php中Notice Trying to get property of non-object

php中Notice Trying to get property of non-object

出現這個問題的原因會有很多種情況,我的是下面這一種:原本資料庫語句我是這麼寫的:$sql = "SELECT * FROM users WHERE u_name =".$name;改成這樣就沒報錯了:$sql = "SELECT * FROM users WHERE u_name ='".$name."'";