Created
December 23, 2016 12:19
-
-
Save gunaevart/a4d14470ccda287a21769da46bebe4ce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Connect { | |
public $mysqli; | |
public function __construct() { | |
$this->mysqli = new mysqli('localhost', 'root', '', 'octaber'); | |
} | |
public function selectQuery() { | |
$result_set = $this->mysqli->query("SELECT * FROM `testtable`"); | |
if (!$result_set) return false; | |
while ($row = $result_set->fetch_assoc()){ | |
$data[$i] = $row; | |
$i++; | |
} | |
return $data; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__ . '/class/Connect.php'; | |
$connect = new Connect(); | |
$myrow = $connect->selectQuery(); | |
echo '<PRE>'; | |
print_r($myrow); | |
echo '</PRE>'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment