Ok i do it
$table = get_personel_table(1); function get_personel_table($id) { global $connection; $query = "SELECT * "; $query .= "FROM employees "; $query .= "WHERE id=" . $id . " "; $query .= "ORDER BY id ASC"; $query_result = mysql_query( $query , $connection ); confirm_query($query_result); $query_result_array = mysql_fetch_array($query_result); return $query_result_array;
and i do foreach
foreach($table as $table_var) { echo "<td>" . $table_var . "</td>"; }
and thus I get a double output ... "1 1 1 1 jordan jordan 9108121544 9108121544 testEmail testEmail testAddress testAddress testCounty testCounty"
this is below print_r result
Array ( [0] => 1 [id] => 1 [1] => 1 [department_id] => 1 [2] => jordan [name] => jordan [3] => 9108121544 [EGN] => 9108121544 [4] => testEmail [email] => testEmail [5] => testAddress [address] => testAddress [6] => testCounty [country] => testCounty )
The information I have in the database is: id => 1, department_id => 1, etc .... My question is why I get double feedback (I donβt know what to call it), 0 = id, 1 = department_id, 2 = name, etc.
and when I do foreach (...), I get everything twice.
source share