
function selctsql(){ $mysqli = new mysqli("host","user","pass","DBname"); if ($mysqli->connect_error){ print("接続失敗:" . $mysqli->connect_error); exit(); } $result = $mysqli->query("SELECT * FROM test ORDER BY id DESC"); if($result){ //1行ずつ取り出し while($row = $result->fetch_object()){ //エスケープして表示 $hoge[0] = $row->qur1; $hoge[1] = $row->qur2; } } return $hoge; }