Jump to content

lloyd31

Members
  • Posts

    1
  • Joined

  • Last visited

lloyd31's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Hi. I need help on how should I print the results using a foreach loop or for loop in a multi-dimensional array. The output should be something like this: ---------------------------------- CustomerNumber CustomerName - Phone - Address ---------------------------------- and if there is a two CustomerName but a same CustomerName, output should be like this: ---------------------------------- CustomerNumber CustomerName - Phone - Address CustomerName - Phone - Address ---------------------------------- Please need help..Thanks... Here is sample of my code: <?phpinclude 'mysql_connect.inc';echo "</br></br>";[/font][/color] $query = "SELECT * FROM customers";$result = mysqli_query($conn, $query);while($row = mysqli_fetch_array($result)){$header = $row["customerNumber"];$details = $row["customerName"]."^".$row["phone"]."^".$row["addressLine1"];$array[$header][$details] = "header & details";} foreach($array as $arr1){$key = key($arr1);echo $key."</br>";} echo "<hr></br>test by: Lloyd Liongson";?>
×
×
  • Create New...