score:2

Accepted answer

you'd first have to build the non-db-related parts into your php structure, e.g.

$data = array(
   0 => array(
        'name' => 'female',
        'marker' => array (
             'symbol': 'circle'
             etc....),
        'data' => array() // database insertion occurs here
        ),
   1 => array(
        'name' => 'male',
        etc...
        )
);

$locations = array('female' => 0, 'male' => 1, etc...) // reverse map your 'name' fields

while(...) {
     $data[$locations[$row['name']]][data]['x'][] = $row['price'];
     $data[$locations[$row['name']]][data]['y'][] = $row['quantity'];
           ^^^^^^^^^^^^^^^^^^^^^^^^--- reverse lookup to get right array index for 'name'
}

score:0

first i'm going to recommend you take a look at your sql query, especially the part of where id=$1. if i'm not mistaken (and on this i'm fairly sure.) your query is going to return one (1) row not many like what you probably want. i would recommend removing the where clause and see if that solves your problem.

if not drop me a line and i'll see what else i see and we can go from there.


Related Query

More Query from same tag