1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| <?php
$response = array();
include '../../connex.php';
$sql=mysql_query("SELECT usernamejoueurs FROM roomies WHERE username = 'kanel' " );
while ($donnees = mysql_fetch_array($sql)){
$username = $donnees['usernamejoueurs'];
$names = array( " $username ", );
}
// make sure they're sorted alphabetically, for binary search tests
sort($names);
foreach ($names as $i => $name)
{
$filename = str_replace(' ', '', strtolower($name));
$response[] = array($i, $name, null, $name);
}
header('Content-type: application/json');
echo json_encode($response); |
Partager