Reputation:
How to print the records array in the tpl file? This is my php code:
$inbox=mysql_query("SELECT * FROM table1");
$inbox_rec=array();
while($inbox_data=mysql_fetch_assoc($inbox))
{
$sent_mail_id = 12;
array_push($inbox_rec,$inbox_data);
$send=mysql_query("SELECT * FROM table2 where id = '$sent_mail_id'");
$i=0;
while($send_data=mysql_fetch_assoc($send))
{
array_push($inbox_rec[$i],$send_data);
}
$i++;
}
$smarty->assign(array("inbox_rec"=>$inbox_rec));
I want to view the records in tpl file as I have used the code in tpl file as shown below:
{foreach $inbox_rec as $value}
<table class="table table-responsive">
<tbody>
<tr>
<td align="left">
<h5 style="color:#426AD5;"><b>{$value.mail_name}</b></h5>
<h5 style="color:#426AD5;"><b>{$value.mail_email}</b></h5>
<h5 style="color:#595959;"><b>{$value.mail_msg}</b></h5><br />
{foreach inbox_rec as $detail}
<h5 style="color:#426AD5;"><b>Admin</b></h5>
<h5 style="color:#595959;"><b>{$detail[$i].sent_mail_msg}</b></h5><br />
{/foreach}
{/foreach}
Upvotes: 0
Views: 5185