php - Trouble creating array -
I have a problem ?? | I am trying to create an array from a mysql table but I do not know how to format data coming from MySQL in an array in php. Even what I have done so far ... // This is where I have no clue to get the right shape ... ?? o.addNode (003, 002, '', 'Jane Doe \ nAst Manager'); Where 003 is $ currempno 002 $ currsupervisor is Jane Doi \ n Est Manager is $ currtitle To get o.addNode With (comma and double quotes and closing); = "text"> If I understand correctly , Then you are actually trying to make the line Then just put the values in the string and format the way you want - there is no need to create any other array - you can create the final string and put them in the array Can: // Generate organization data $ result_org = mysql_query ("select emp_no, sup_empno, name, employees by title"); // starts a container array $ orgArray = array (); While ($ line = mysql_fetch_array ($ result_org, MYSQL_ASSOC)) {$ currempno = $ row ['emp_no']; $ Currsupervisor = $ row ['sup_empno']; Title = $ line ['name'] for $. '\ N'. $ Line ['title'];
// Enter the records of each database in a $ $ buildorg = array ("$ currempno", "$ currsupervisor", "$ currtitle"); // Container array adds each array in array_push ($ orgArray, $ buildorg); } // Show data to verify resonance ($ orgArray); / /
o.addNode (003, 002, '', 'jane doe \ n est manager');
$ currempno = $ line ['emp_no']; $ Currsupervisor = $ row ['sup_empno']; Title = $ line ['name'] for $. '\ N'. $ Line ['title']; $ Output = sprintf ("O. adnode (% 03d,% 03d, '', '% s');", $ karamono, $ taxisupwizard, $ drafting); Array_push ($ orgArray, $ output);
Comments
Post a Comment