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:
If your database is MySQL then, you can use mysql_field_name() and mysql_fetch_field() function in php.
$res = mysql_query('select * from customer', $link);
echo mysql_field_name($res, 0); // print cust_id
echo mysql_field_name($res, 1); // print cust_name
echo mysql_field_name($res, 2); // print cust_age
Run this query in php and check if number of rows > 0 :- DESC tablename '%columns_name%'