这是我加载表格并以 HTML 格式显示的脚本table
。
$fields = $this->db->list_fields($tableName);
$fieldData = $this->db->field_data($tableName);
$this->db->from($tableName);
$this->db->order_by($fields[0], "asc");
$query = $this->db->get();
$table = $query->result();
$columnsQ = $this->db->query("select count(column_name) from information_schema.columns where table_name = '".$tableName."'");
$columns = $columnsQ->row();
foreach($table as $row) {
echo "\t<tr class='value'>\n";
$colNr = 1;
foreach ($row as $tdVal) {
$colNr0 = $colNr-1;
$valType = $fieldData[$colNr0]->type;
$isForeign; // how to get info?
if($colNr==1) {
echo "\t\t<td data-valType='$valType' class='id'>$tdVal</td>\n"; }
else {
echo "\t\t<td data-isForeign='$isForeign' data-valType='$valType' data-colNr='$colNr'>$tdVal</td>\n"; }
$colNr++;
}
}
</table>";
应该通过什么查询$isForeign
来获取有关加载的值是否是外键的信息?