Antonio Montillo
Antonio Montillo

Reputation: 3

Split and extract data from a field php mysql

I have a problem with this data saved in a MySQL row:

34:3,37:2,64:1,85:4

The first number is an ID that identifies a user, the second number (separated by ":") is the arrival order position.

I need to extract and split the data to create a table with the arrivals order:

Something similar to:

name position 

Any suggestion?

Upvotes: 0

Views: 49

Answers (2)

jeremyb
jeremyb

Reputation: 492

$split = explode(';', $myvars);
$id = $split[0];
$whatever = $split[1];

Upvotes: 1

geggleto
geggleto

Reputation: 2625

Simple: explode()

explode(",", $yourdata);

PHP Explode

Upvotes: 2

Related Questions