When I run :
while($r = mysql_fetch_assoc($result3)) {
echo json_encode($r);
}
the results is :
{"test1":"1","test2":"2","test3":"3","test4":"4"}
{"test1":"5","test2":"5","test3":"7","test4":"8"}
my question is : How can I create arrays from the results above knowing that the number of lines is not fixed, it may change depend on the data. So, I could make changes to the arrays and parse it in a format similar to this :
["test1"=>"1","5"],
["test2"=>"2","6"],
["test3"=>"3","7"],
["test4"=>"4", "8"]
Thanks!!
print_r($result3);then put the result over here whatever it display its easy to help it out$result3is (presumably) a MySQL resource identifier.test2(from5in the current output to6in the desired output) is merely a typo? In any event, each array element has its own key so the desired output as shown doesn't really make sense: perhaps you are instead after something like{ "test1" : [1,5], "test2" : [2,5], ... }?