Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
問題は「クラス stdClass のオブジェクトを int に変換できませんでした」
これはコードです:
$user = mysql_fetch_object(mysql_query("SELECT * FROM `user` WHERE username='$user_name'")); if($user) == 0){
どうすればこの問題を解決できますか?
文字列や整数ではなくデータベースからオブジェクトをフェッチしているため、クラスのフィールドにアクセスする必要があり、フィールドは次の方法でチェックできます。
if ($user->user_id === null ) or if ($user->{'user.id'} == null ) if there are problems with `user.id`