<?php
/*
$host = "localhost"; // host of MySQL server
$user = "root"; // MySQL user
$pwd = ""; // MySQL user's password
$db = "apps"; // database name
 
// Create connection
$con = mysqli_connect($host, $user, $pwd, $db);
 
// Check connection
if(mysqli_connect_errno($con)) {
    die("Failed to connect to MySQL: " . mysqli_connect_error());
} 
*/

	include('fonctions.php');

	$connexion = DB(); 	
 
	$sql = "SELECT * FROM table_jeux"; // ORDER By id";
	$result = mysqli_query($connexion, $sql);
	
	$row_cnt = mysqli_num_rows($result);
	echo $row_cnt;
 
	// an array to save the application data
	$rows = array();
/*	
	while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) 
	{
		$rows[] = $row; 
	}
*/	
	
	while($row =mysqli_fetch_assoc($result))
    {
        $rows[] = $row;
    }
	
 
	echo json_encode($rows);
 
	// close the database connection
	//mysqli_close($connexion);
	
	print_r($rows);

?>