Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function db_connect(){
- $host = 'localhost';
- $user = 'tolik';
- $pass = '1234';
- $db = 'collection';
- $connection = mysqli_connect($host, $user, $pass, $db);
- // $db_select =
- if (!$connection){
- return false;
- }
- return $connection;
- }
- function db_result_to_array($result){
- $res_array = array();
- $count = 0;
- while ($row = mysqli_fetch_array($result)){
- $res_array[$count] = $row;
- $count++;
- }
- return $res_array;
- }
- function get_products(){
- db_connect();
- $query = "SELECT * FROM clothes ORDER BY id DESC";
- $result = mysqli_query($query);
- $result = db_result_to_array($result);
- return $result;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement