question

mhd.hamouday avatar image
mhd.hamouday asked

get column name and view it using php

hello Please can you help me about how can I get column name from database and view it using php I find this SELECT COLUMN_NAME FROM information_schema.columns WHERE table_name = 'mohamad' ORDER BY ordinal_position ------------------------------------------------------ but I don't know how I can view result with php.. -------------------------------------------------------- this problem take alot of time and it is not solvet yet... thank you very much
order-byphporderingdatabase-nameresultset from variable
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
VishalhSingh avatar image
VishalhSingh answered
Which version of sql server you are using? If its 2008 and above you can read it from sys.columns table. You can filter it for the table you need all the columns for by specifying OBJECT_ID('your_table_name_here') I am not expert in PHP so can't help displaying it on that.
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.