I have this query
$sqlID = oci_parse($connect,"select C_ID from T_user");
oci_execute($sqlID);
Put the result into array
while ($row = oci_fetch_array($sqlID, OCI_ASSOC)) {
$rows[] = $row;
}
I need to process the array further, so I send it to javascript:
var arr = <?php echo json_encode($rows); ?>;
The result from console log are:
0: {C_ID: "19990535"}
1: {C_ID: "19990553"}
2: {C_ID: "20000118"}
3: {C_ID: "20030130"}
4: {C_ID: "20050124"}
5: {C_ID: "20050179"}
6: {C_ID: "20090027"}
7: {C_ID: "20110153"}
8: {C_ID: "20120112"}
9: {C_ID: "20140083"}
10: {C_ID: "20170008"}
11: {C_ID: "20190206"}
My desired output are:
0: "19990535"
1: "19990553"
2: "20000118"
3: "20030130"
4: "20110153"
5: "20120112"
6: "20140083"
7: "20170008"
8: "20190206"
9: "20050179"
10: "20050124"
I try with : var arr = <?php echo json_encode(array_values($rows)); ?>;
but the result still the same.
How to achieve it?