It seems so hard with the arrays that my head i sabout to explode. I have a database from which I'm supposed to create some arrays. For example 2 tables with a survey options and answers (questions and number of answers): are you married? should return the following results: yes = 2; (2 answered with yes) No =4; (4 answered with no) Now the SQL : $sql = "SELECT poll_options.poll_option AS the_option, COUNT(poll_answers.ID) AS answers FROM poll_options LEFT JOIN poll_answers ON(poll_answers.ID_option=poll_options.ID) WHERE ID_question='".mysql_real_escape_string($row_question['ID'])."' GROUP BY poll_options.ID"; PHP: how do I create an array to look like this: $data = array( array('yes', 'no'), array(2, 4) ); PHP: Thank you.
why not just return the data as $data = array('yes' => 2, 'no' => 4); Code (markup): then you can access it with $data['yes'] for the yes votes, $data['no'] for the no votes.