Just nu i M3-nätverket
Jump to content

array loop


pepino

Recommended Posts

Har massa variablar som ser ut så här:

 

$_SESSION["korg"][xxx]["langd"]

$_SESSION["korg"][xxx]["antal"]

$_SESSION["korg"][xxx]["produktid"]

 

$_SESSION["korg"][xxx]["langd"]

$_SESSION["korg"][xxx]["antal"]

$_SESSION["korg"][xxx]["produktid"]

 

$_SESSION["korg"][xxx]["langd"]

$_SESSION["korg"][xxx]["antal"]

$_SESSION["korg"][xxx]["produktid"] osv....

 

Om man nu ska skriva ut dessa i en tabell hur gör man då? Tex

 

Produktid antal längd

12 2 2m

56 3 5m

 

 

 

 

[inlägget ändrat 2004-09-30 20:38:14 av pepino]

Link to comment
Share on other sites

Typ,

[color="#0000ff"]foreach[/color] ([color="#0000ff"]$[/color]_SESSION['korg'] [color="#0000ff"]as[/color] $p)
{
[color="#0000ff"]print[/color] "<tr>\n<td>" . $p['produktid'] . "</td>\n" .
'<td>' . $p['antal'] . "</td>\n" .
'<td>' . $p['langd'] . "</td>\n</tr>\n";
}

?

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...