Bonjour

Malgré mes recherches, je n'arrive pas à comprendre pourquoi je n'arrive pas à afficher le résultat de ma requête mysql, je vois bien le résultat de ma requête mais mon manque d'expérience ne me permette pas de trouver la solution
Pourriez-vous me guider svp
Bien à vous

Fichier PHP:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
    try {
        // connection to the database.
        #$pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
        $bdd = new mysqli('localhost', 'user', 'mdp', 'bdd');
 
        // Execute SQL request on the database.
        $sql = "SELECT * FROM articles";
        $response = $bdd->query($sql);
		//$output = $response->fetchAll(PDO::FETCH_ASSOC);
	} catch (Exception $e) {
        die('Erreur : ' . $e->getMessage());
    }
 
    // Print JSON encode of the array.
 //   
	$myArray = array();
	while($row = $response->fetch_array(MYSQLI_ASSOC)) {
        $myArray[] = json_decode(json_encode($row));
	}
	$sortie=json_encode($myArray, JSON_UNESCAPED_SLASHES);
 
	echo("'"); 
	print($sortie);
	echo("'");
?>

Main Activity:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
    try {
        // connection to the database.
        #$pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
        $bdd = new mysqli('localhost', 'root', 'root', 'simag_dev');
 
        // Execute SQL request on the database.
        $sql = "SELECT * FROM articles";
        $response = $bdd->query($sql);
		//$output = $response->fetchAll(PDO::FETCH_ASSOC);
	} catch (Exception $e) {
        die('Erreur : ' . $e->getMessage());
    }
 
    // Print JSON encode of the array.
 //   
	$myArray = array();
	while($row = $response->fetch_array(MYSQLI_ASSOC)) {
        $myArray[] = json_decode(json_encode($row));
	}
	$sortie=json_encode($myArray, JSON_UNESCAPED_SLASHES);
 
	echo("'"); 
	print($sortie);
	echo("'");
?>

Logcat:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
02-04 13:39:57.736 12500-12500/? I/zygote: Not late-enabling -Xcheck:jni (already on)
02-04 13:39:57.840 12500-12500/? W/zygote: Unexpected CPU variant for X86 using defaults: x86
02-04 13:39:58.159 12500-12500/com.simag.www.projet_select W/ActivityThread: Application com.simag.www.projet_select is waiting for the debugger on port 8100...
02-04 13:39:58.240 12500-12500/com.simag.www.projet_select I/System.out: Sending WAIT chunk
02-04 13:39:58.658 12500-12507/com.simag.www.projet_select I/zygote: Debugger is active
02-04 13:39:58.659 12500-12500/com.simag.www.projet_select I/System.out: Debugger has connected
02-04 13:39:58.660 12500-12500/com.simag.www.projet_select I/System.out: waiting for debugger to settle...
02-04 13:39:58.861 12500-12500/com.simag.www.projet_select I/System.out: waiting for debugger to settle...
02-04 13:39:59.062 12500-12500/com.simag.www.projet_select I/System.out: waiting for debugger to settle...
02-04 13:39:59.263 12500-12500/com.simag.www.projet_select I/System.out: waiting for debugger to settle...
02-04 13:39:59.465 12500-12500/com.simag.www.projet_select I/System.out: waiting for debugger to settle...
02-04 13:39:59.666 12500-12500/com.simag.www.projet_select I/System.out: waiting for debugger to settle...
02-04 13:39:59.867 12500-12500/com.simag.www.projet_select I/System.out: waiting for debugger to settle...
02-04 13:40:00.068 12500-12500/com.simag.www.projet_select I/System.out: waiting for debugger to settle...
02-04 13:40:00.270 12500-12500/com.simag.www.projet_select I/System.out: debugger has settled (1412)
02-04 13:40:00.365 12500-12500/com.simag.www.projet_select I/InstantRun: starting instant run server: is main process
02-04 13:40:00.860 12500-12530/com.simag.www.projet_select D/OpenGLRenderer: HWUI GL Pipeline
02-04 13:40:00.888 12500-12531/com.simag.www.projet_select D/NetworkSecurityConfig: No Network Security Config specified, using platform default
02-04 13:40:00.995 12500-12530/com.simag.www.projet_select I/zygote: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
02-04 13:40:00.995 12500-12530/com.simag.www.projet_select I/OpenGLRenderer: Initialized EGL, version 1.4
02-04 13:40:00.996 12500-12530/com.simag.www.projet_select D/OpenGLRenderer: Swap behavior 1
02-04 13:40:00.997 12500-12530/com.simag.www.projet_select W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
02-04 13:40:00.997 12500-12530/com.simag.www.projet_select D/OpenGLRenderer: Swap behavior 0
02-04 13:40:01.017 12500-12530/com.simag.www.projet_select D/EGL_emulation: eglCreateContext: 0x953ea180: maj 2 min 0 rcv 2
02-04 13:40:01.083 12500-12530/com.simag.www.projet_select D/EGL_emulation: eglMakeCurrent: 0x953ea180: ver 2 0 (tinfo 0xb01eda40)
02-04 13:40:01.478 12500-12500/com.simag.www.projet_select I/Choreographer: Skipped 31 frames!  The application may be doing too much work on its main thread.
02-04 13:40:01.492 12500-12530/com.simag.www.projet_select D/EGL_emulation: eglMakeCurrent: 0x953ea180: ver 2 0 (tinfo 0xb01eda40)
02-04 13:40:01.576 12500-12530/com.simag.www.projet_select I/chatty: uid=10085(com.simag.www.projet_select) RenderThread identical 1 line
02-04 13:40:01.717 12500-12530/com.simag.www.projet_select D/EGL_emulation: eglMakeCurrent: 0x953ea180: ver 2 0 (tinfo 0xb01eda40)
02-04 13:40:01.782 12500-12530/com.simag.www.projet_select D/EGL_emulation: eglMakeCurrent: 0x953ea180: ver 2 0 (tinfo 0xb01eda40)
02-04 13:40:01.818 12500-12500/com.simag.www.projet_select E/JSON*Parser: Erreur parsing data org.json.JSONException: Value [{"art_id":"1","art_ref":"SERV1","art_design":"Serveur restaurant","art_prix":"287","art_four":"DELL"},{"art_id":"2","art_ref":"MH33","art_design":"Routeur","art_prix":"185","art_four":"MERAKY"},{"art_id":"3","art_ref":"ECR10","art_design":"Ecran 10","art_prix":"56","art_four":"APLUS"},{"art_id":"4","art_ref":"ZONE1","art_design":"Deplacement Paris Intra","art_prix":"75","art_four":"AWADAC"},{"art_id":"5","art_ref":"ZONE2","art_design":"Deplacement IDF","art_prix":"105","art_four":"AWADAC"},{"art_id":"6","art_ref":"ZONE3","art_design":"Deplacement hors IDF","art_prix":"175","art_four":"AWADAC"}] of type java.lang.String cannot be converted to JSONArray
02-04 13:40:01.868 12500-12530/com.simag.www.projet_select D/EGL_emulation: eglMakeCurrent: 0x953ea180: ver 2 0 (tinfo 0xb01eda40)