Solved

Parse MySQL data into an array

Posted on 2013-10-24
2
303 Views
Last Modified: 2013-10-24
I am using Wordpress which uses MySQL.

One of the plugins stores data in this format:

[["","","Member Name","Total Points"],["1.","","Player 1","80"],["2.","PC","Player 2","60"],["3.","","Player 3","60"]]

Open in new window


This data represents four columns in a table which I need to parse into an array for my custom application.
0
Comment
Question by:mcnuttlaw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 500 total points
ID: 39596867
The data is in JSON format so you can use the json_decode function to get an array:

$str = '[["","","Member Name","Total Points"],["1.","","Player 1","80"],["2.","PC","Player 2","60"],["3.","","Player 3","60"]]';
$myArray = json_decode($str);
var_dump($myArray);

Open in new window

0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 39597125
Bookmark this: http://www.json.org/
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question