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 ... // 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'];

// This is where I have no clue to get the right shape ... ??

  // 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 \ 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

  o.addNode (003, 002, '', 'jane doe \ n est manager');   

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:

  $ 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

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -