Gebruik maken van while
Geplaatst: 04 feb 2007, 14:14
Ik weet hoe je dat precies moet doen met TemplateParser en php (while)
Ik wil dus zeg maar alle artists uit articles halen, alleen hoe doe ik dit?
Ik wil dus zeg maar alle artists uit articles halen, alleen hoe doe ik dit?
Code: Selecteer alles
$sql=mysql_query("SELECT * FROM `articles` ORDER BY artists ASC ");
while($results = mysql_fetch_object($sql))
{
$template->assign_block_vars('artists', $results->artists);
}
$template->set_filenames(array(
'body' => 'artists_body.tpl')
);
$template->assign_vars(array(
'L_ARTISTS'=> $results->artists,
'L_ADD' => Add,
'L_EDIT' => Edit,
'U_ARTISTS'=> append_sid('artists.'.$phpEx.'?action=artists&id='.$idart.' '),
'U_ADD' => append_sid('articles'.$phpEx.'?action=add'),
'U_EDIT' => append_sid('articles.'.$phpEx.'?action=edit&id='.$idart.' ')
)
);