SELECT count(*) FROM information_schema.`COLUMNS` C
WHERE table_name = 'your_table_name'
AND TABLE_SCHEMA = "your_db_name"
TABLE_SCHEMA is required only if table name exists in more than one db
SELECT count(*) FROM information_schema.`COLUMNS` C
WHERE table_name = 'your_table_name'
AND TABLE_SCHEMA = "your_db_name"
TABLE_SCHEMA is required only if table name exists in more than one db
Hi,
this should help
$myQuery = "show columns from $my_table_name";
$result = mysql_query($myQuery);
$row = mysql_fetch_row($result);
$columncount = count($row);
it so simple:-
$result=mysql_query("select * from table_name");
echo mysql_num_field($result);
finish....
should be:
mysql_num_fields($result);
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.