Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

php array help

Avatar of 3xtr3m3d
3xtr3m3d asked on
JavaScriptPHPMySQL Server
2 Comments1 Solution194 ViewsLast Modified:
Hi

This is the array im working on
$x = 0;
while($row = mysql_fetch_object($sql_result) )
{
$json[$x] = array    (
   $json[$x] = array    (   
                            'id' => $row->fid,
                            'rel' => $row->ftype,							
                        ),
			
			"data" => $row->ftitle,
			"state" => ""
);  
$x++;

}
echo  json_encode($json);

this out put is like

[{"0":{"id":"3","rel":"file"},"data":"file1.doc","state":""},{"0":{"id":"4","rel":"file"},"data":"filetest.doc","state":""}]

i have no idea why "0" appear on output.

is there way to replace "0" with "attr" ?

any help would be great.

Thanks