Witam.
Chciałbym zrobić edycje newsów z użyciem pętli ale nie wiem jak do wyników przypisać stronę z edycją.


  1. if (isset($_GET['step']) && $_GET['step'] == 'snews'){
  2. $table = array();
  3.  
  4. $result = mysql_query( 'SELECT * FROM news order by id desc limit 0, 2 ' ) or die ( mysql_error() );
  5.  
  6. while( $row = mysql_fetch_assoc( $result ) )
  7.  
  8. $table[] = $row;
  9.  
  10. $smarty -> assign ("step", $_GET['step']);
  11. $smarty->assign(array( 'artykuly' => $table,
  12. "log" => $login ));
  13. $smarty->display('admin.tpl');



Plik tpl
  1. {if $step == "snews"}
  2.  
  3. {foreach from=$artykuly key=key item=item}
  4. <a href="admin.php?step={$item.id}">{$item.id}<b>Tytuł: {$item.tytul}</b></a><br>
  5.  
  6. {/foreach}
  7. {/if}


Edit: Jak zrobić do tego stronę questionmark.gif bo póki co odsyła mnie od strony głównej admin.php