0

I want to represent my SQL data in graph using react native and PHP ,I tried many times but I could not do it with dynamic data.

This is my php file that fetch my data:

<?php

$serverName="DESKTOP-T5SLVUB\SQL2008R2";
$connectionInfo=array("Database"=>"Netos_DB","UID"=>"sa","PWD"=>"123");
$conn=sqlsrv_connect($serverName,$connectionInfo);
$sql = "select  ChiffreAffaire from V502_client where Mois=2 and Annee=2020 "; 
$stmt = sqlsrv_query( $conn, $sql  );
 while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ){
      $Item = $row;
      $json = json_encode($Item);    echo $json;
}
?>

The output of this file:

{"ChiffreAffaire":"4800.00"}{"ChiffreAffaire":"12000.00"}
Dale K
  • 25,246
  • 15
  • 42
  • 71
imanealami
  • 189
  • 5
  • 13
  • You should add more information to your question. For all we know, the output is correct. – GJ Nilsen Mar 01 '20 at 22:13
  • I want to use chart api in react native ,for example this one : https://www.npmjs.com/package/react-native-svg-charts but i don't know how because in this examples they work with data like [1,2,3] .I really need your help pleaaaase – imanealami Mar 01 '20 at 22:24
  • Then you should rephrase your question. From what you have written, its impossible to know what you really want. The PHP code looks correct, as does the output. So whats the problem? – GJ Nilsen Mar 01 '20 at 22:51
  • I want to represent the data that I fetch from php file which is {"ChiffreAffaire":"3200} in graph in react native but I don't know how – imanealami Mar 01 '20 at 22:57
  • https://stackoverflow.com/questions/60474495/how-to-draw-barchart-with-mysql-data-in-react-native?noredirect=1#comment106985476_60474495 this is a link to understand my problem if you need more details – imanealami Mar 01 '20 at 23:07

0 Answers0