MyBB Community Forums

Full Version: How would I parse this one?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I am damn trying to get over one code since hours but cannot figure it out at all.

In modcp_moderatorlog,

there in the data columned table, there is some phrase as below:

a:2:{s:3:"uid";s:1:"4";s:8:"username";s:5:"test2";}

When its parsed, it is displayed as:

User: test2

The above parsed thing is shown in modcp in mod logs in information column.

I'm trying to use and fetch the data table, but its printed as non-parsed like:

a:2:{s:3:"uid";s:1:"4";s:8:"username";s:5:"test2";}

I want it to be in parsed (final form).

The query am using is:

$del = $db->query("SELECT * FROM ".TABLE_PREFIX."moderatorlog WHERE fid=0 AND tid=0 AND pid=0 ORDER BY dateline DESC");

$delby = get_user($rdel['data']);


and then trying to get it printed on location, I am using phrase:

' .$delby['data']. '

But damn, it doesn't prints the parse form but only below thing:

a:2:{s:3:"uid";s:1:"4";s:8:"username";s:5:"test2";}

Any help? Undecided
Quite don't get that, can you mention how it can be used here? :/
$data = json_decode($delby['data']);

var_dump($data);

You can see an example here: http://stackoverflow.com/questions/12700...ode-in-php

I don't have a local copy of MyBB of this PC, so I can't give you the exact code.
Didn't work. Sad
What didn't work? How are you doing it?
I did exactly as you told but it didn't produced output. :/
What's the whole code?
I used (not whole, from the middle, am writing):

while($repdel = $db->fetch_array($repdellist)){

$user = get_user($repdel['uid']);
$repdelby = get_user($repdel['data']);
$data = json_decode($repdel['data']);

and on one of the trows, I used:

' . var_dump($data) . '

But it didn't got to work.
var_dump is going to show you a human readable version of the json encoded data. I gave you the link to the example so you could take what you want from that and adapt it to your code.
Pages: 1 2