logicslab Posted July 22, 2010 Share Posted July 22, 2010 Hi Friends, I have some data from database Table which must be display as output . I assign the array in PHP page to smarty template.... The array structure I plan to assign to smarty is : Array ( [publisher] => Array ( [0] => pen books [1] => pen books [2] => Jacks books [3] => May books [4] => Ram books ) [title] => Array ( [0] => For Earners [1] => Bol in glance2 [2] => Dummy For Earners [3] => Bol in glance2 [4] => New man ) [isbn] => Array ( [0] => 8709873689098 [1] => 5495736309876 [2] => 9789873689093 [3] => 9785495789760 [4] => 9781119087441 ) ) I need to get the display output in HTML as : display output ================ publisher title isbn ===== === ======= pen books For Earners 8709873689098 jacks books Bol in glance2 5495736309876 May books Dummy For Earners 9789873689093 Ram books New man 9781119087441 Please give a method to do the things in smarty. I need a solution using foreach or section or both in smarty . Please Give a method to accomplish same in smarty .... Thanks in Advance ... Regards Anes P.A (anes(dot)pa(at)gmail(dot)com) or(anespa(at)admod(dot)com) Link to comment https://forums.phpfreaks.com/topic/208505-how-to-manipulate-array-data-in-smarty/ Share on other sites More sharing options...
dreamwest Posted July 22, 2010 Share Posted July 22, 2010 PHP: $title = 'test'; //variable example $arr[] = array('id' => 10, 'title' => $title); $smarty->assign( 'arr', $arr); TEMPLATE: {section name=i loop=$arr} {$arr[i].id}<br> {$arr[i].title}<br> etc.... {/section} Link to comment https://forums.phpfreaks.com/topic/208505-how-to-manipulate-array-data-in-smarty/#findComment-1089480 Share on other sites More sharing options...
logicslab Posted July 22, 2010 Author Share Posted July 22, 2010 Hi Friend, Any way I take the solution in some other way. Friend I have a Doubt Regarding Queries, that means I have a Table named : TEST in mysql. it has some fields like : mobi_deleted,pub_deleted,pdf_deleted .... according to operation any one of field is updated .... in my php i got a variable , $var , it's value may be mobi, pub or pdf.... Do I can Write a query like: UPDATE TEST SET {$var}_deleted = 0; is this Work properly.... Waoting for ur valuable Reply... Bye Anes Link to comment https://forums.phpfreaks.com/topic/208505-how-to-manipulate-array-data-in-smarty/#findComment-1089586 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.