PDO::FETCH_OBJ php

后端 未结 2 391
自闭症患者
自闭症患者 2021-01-26 07:16

PDO::FETCH_OBJ -> Returns an anonymous object with property names that correspond to the column names returned in your result set. For example:

 Array ( [0] =>         


        
2条回答
  •  故里飘歌
    2021-01-26 08:02

    You should use something like the following:

    foreach ($results as $row) {
            print_r($row->email);
    }
    

    If you expect to have just one row returned, it is always a good idea to check that. You can use count() with your $results variable like this:

    if (count($results)==1) {
          print_r($results[0]->email);
    }
    

提交回复
热议问题