[eluser]Unknown[/eluser]
Hi, all !
i have
Code:
$data['table'] = $table[$this->input->post('table')];
$result = $this->db->query("DESCRIBE " . $data['table']);
$data['alias'] = $result->result();
and
Code:
$data = array('table' => $data['table'], 'fields' => $data['alias']);
Ok, push to template...
Code:
$this->template->parse_view('table','site/default/block/table_fields', $data);
$this->template->render();
Then, code in 'table_fields.php'
Code:
{fields}
<tr>
<th class="even" >{Field}</th>
<td align='center'>{Type}</td>
<?php
$key = '{Key}'; // <= HERE
// How to check $key. Ex:
if(strstr($key,'PRI') == 0) // <= not work
echo "Primary key";
// Always echo "Primary key"
// My table have 3 fields(id(PRI),user,email)Then, echo 3 line "Primary key". However, i want echo 1 line "Primary key" at id.
?>
</tr>
{/fields}
How to check variable $key is what ?