• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved [PHP] Foreach + array list

Kavvson

Gdy boli cie glowa wez
Joined
Jun 25, 2008
Messages
1,177
Reaction score
72
Location
Poland
I think i can display this

Code:
Name :
    <input type="text" name="player_name" value="<?PHP echo $result['name']; ?>" />
    <br>
    Health :
   <input type="text" name="player_health" value="<?PHP echo $result['health']; ?>" />
       <br>
    healthmax :
<input type="text" name="player_healthmax" value="<?PHP echo $result['healthmax']; ?>" />
       <br>
    account_id :
<input type="text" name="player_account_id" value="<?PHP echo $result['account_id']; ?>" />

As a foreach and array list. But i dont have any idea how to. Someone can help?
 
Last edited:
Solved

PHP:
<?php
    $tab = array('Health' => $result['health'] );
 
  
  reset($tab); 
  while (list($klucz, $wartosc) = each($tab))
    echo ''.$klucz.' : = '.$wartosc.'<br />';
 
  echo '<br />';
 
 
  foreach($tab as $klucz => $wartosc)
    echo '$tab['.$klucz.'] = '.$wartosc.'<br />';
 
?>
 
Back
Top