Jump to content

[SOLVED] HELP-Creating a dynamic array with keys other then numbers


pquery

Recommended Posts

Hello,

 

I'm having a little trouble having my smarty template which is generating

 

Here is the main code of the tpl file which is doing the work:

 

{foreach from=$candidates key=myId item=i} 
<tr>
 <td align="right"><input type="checkbox" name="candidate[]" value="{$i.applicationID}"> </td>
 <td align="left"> {$i.firstName} {$i.lastName}</td>
 <td>
   <select name="station[]">
      {html_options options=$stations}
      </select>
 </td>
</tr>
{/foreach}

 

And here is the code from my php file that is generating the actual page:

 

 

 

WHILE ( $row = mysql_fetch_array($result)) {
         //print_r($row);
         $candidates[] = $row;
        
        }

$smarty->assign("stations", $stations);


$smarty->assign("assessors", $assessors);

$smarty->assign("candidates", $candidates);    

 

And finally the row output from a print_r statement (names have been starred out to protect the innocent  8)  )

 

Array ( [0] => Array ( [0] => 8965dd88 [applicationID] => 8965dd88 [1] => S*** [firstName] => S*** [2] => G*** [lastName] => G*** ) ) 

 

I've tried building this array about 5 different ways, but nothing seems to be working right for me. I've also noticed that the server I'm using is using PHP 5.1.6 so array_fill_keys wouldn't work for me

 

any ideas are appreciated.

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.