mysql 获取表的列,php判断表中的某个列是否存在

sql语句:

desc 表名;
show columns from 表名;
describe 表名;
show create table 表名;

use information_schema
select * from columns where table_name='表名';


php:

$result = $this->execute("show COLUMNS FROM `admin`");
$filed='';
foreach($result as $res){
   $filed .=','.$res['Field'];
}
strpos($filed,'id')




你可能感兴趣的:(PHP,mysql,表中列)