what is the query to get all the field names of a table?
I am trying to create an array in PHP to hold the field names of a perticular table.
Thanks!
| SitePoint Sponsor |





what is the query to get all the field names of a table?
I am trying to create an array in PHP to hold the field names of a perticular table.
Thanks!

describe tablename










I figured it out....
PHP Code:$all_rows = array();
$sql = "SHOW COLUMNS FROM `product`";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)){
array_push($all_rows,$row['Field']);
}


17-29% of paid ad clicks are fraudulent. Get protected with Improvely, your online marketing dashboard.
→ Conversion tracking, click fraud detection, A/B testing and more.








hey, both commands are easily available in the mysql manual. i had to make the poster at least work a little bit.
Bookmarks