sql server - Looping for each column name of a MSSQL table using php -


if have [x] [y] [z] columns inside [mytable] table in mssql, know how can loop through each of them using php in order have of columns' name? reason because potentially delete or add column php code make dynamic without having hardcode php page. basically, if have php code similar following,

foreach( column $columname in [sql table])      echo "$columname";     // else } 

it awesome.

select data information_schema.columns system view. filtered on table name.

select column_name  information_schema.columns table_name = 'mytable' 

returns

column_name ----------- x y z 

this gives resultset containing column names, loop through , use values.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -