$result = mysql_query("SELECT blog_title,body FROM blog WHERE post_id='$id' LIMIT 1") or die (mysql_error());
while ($line = mysql_fetch_assoc($result)){
$tasks[] = $line;
$group = $tasks['blog_title'];
$smarty->assign('view', $tasks);
$smarty->assign('group', $group);
//here the error.i want to assign blog_title to title
$smarty->assign('title', "Blog - $group");
newbie,need help.i want to assign blog_title to title
any idea?
You don’t need
$tasks. This variable messes your script up due to the[]you’re using.[] =works just like creating an array using array and applying array_push to it.Here’s what you want to achieve:
By the way: in the first line (
$result =...), ensure that$idis properly escaped (see mysql_real_escape).