私はmysqlとmysqliの両方でデータベースラッパーを書いています。
経由fetch_object()
でデータを取得するには、メソッドを作成しました。
public function fetch($mixed)
{
if (is_resource($mixed))
{
return mysql_fetch_object($mixed);
}
elseif (!empty($mixed))
{
$result = $this->query($mixed);
return mysql_fetch_object($result);
}
elseif (is_resource($this->result))
{
return mysql_fetch_object($this->result);
}
return false;
}
今、私はそれis_resource()
がmysqliにとって良い解決策ではないと聞きました。
それが文字列なのかmysqli_resultなのかを他にどのように確認できますか?