现在的位置: 首页 > 综合 > 正文

根据一个表中的内容标记另一个表的显示内容

2013年02月10日 ⁄ 综合 ⁄ 共 830字 ⁄ 字号 评论关闭

源码如下:

 $t .= '<tr class=dataTableRow><td align="right" width="200">This Group Is Linked To The Following Channel </td><td>';
 $t .= '<table width="100%" cellpadding="0" cellspacing="0">';
 $i = 0;
 $tepsql = tep_db_query("select channelid, title from channels order by title");
 while ($res = tep_db_fetch_array($tepsql)) {
  if ($i == 0) {
   $t .= '<tr>';
  }
  $t .= '<td width="25"><input type="checkbox" name="channel[]" value="'.$res['channelid'].'"';
  if ($info['groupid']) { 
   // Only on edit mode, and there is relationship in the table 'channel_group', this field is checked.
   $tepsql2 = tep_db_query("select * from channel_group where groupid=".$info['groupid']." and channelid=".$res['channelid']);
   if ($res2 = tep_db_fetch_array($tepsql2)) {
    $t .= ' checked';
   }
  }
  $t .= '> '.$res['title'].'</td>';
  $i ++;
  if ($i == 4) {
   $t .= '</tr>';
   $i = 0;
  }
 }
 if ($i != 4) {
  $t .= '</tr>';
 }

 $t .= '</table></td></tr>';

抱歉!评论已关闭.