Check if column exist in Mysql table via php

后端 未结 8 1539
余生分开走
余生分开走 2021-01-04 08:55

I created mysql tables and there I have put some columns.

Now I want to check that a certain column exists in the database via php.

Like this:



        
8条回答
  •  一个人的身影
    2021-01-04 09:17

    You can use mysql_list_fields and mysql_num_fields to get columns of a table

    $fields = mysql_list_fields('database_name', 'table_name');
    $columns = mysql_num_fields($fields);
    

提交回复
热议问题