From: Matthew M. <ma...@tu...> - 2002-10-29 14:44:34
|
While rewriting the sqlImport function, I needed a way to grab the column names of a table. I remember someone telling me that the 'show columns' command is MySQL specific. So I wrote a function named getColumnNames($tableName). You pass it the name of the table and it returns an array of all the names. Give me a +1 amen and I will commit it or gimme a damnation -1 and tell me if there is an easier way that I haven't located. Thanks, Matt Matthew McNaney Internet Systems Architect Electronic Student Services Email: ma...@tu... URL: http://phpwebsite.appstate.edu Phone: 828-262-6493 ICQ: 141057403 |
From: Don S. <do...@se...> - 2002-10-29 14:52:07
|
I haven't seen the function code, but have you looked at this: http://pear.php.net/manual/en/core.db.tableinfo.php I'm not sure that only works after you've executed a query and when you need to know the column names. Don. On Tue, 29 Oct 2002, Matthew McNaney wrote: > While rewriting the sqlImport function, I needed a way to grab the column > names of a table. > > I remember someone telling me that the 'show columns' command is MySQL > specific. So I wrote a function named getColumnNames($tableName). > > You pass it the name of the table and it returns an array of all the names. > > Give me a +1 amen and I will commit it or gimme a damnation -1 and tell me > if there is an easier way that I haven't located. > > Thanks, > Matt > > Matthew McNaney > Internet Systems Architect > Electronic Student Services > Email: ma...@tu... > URL: http://phpwebsite.appstate.edu > Phone: 828-262-6493 > ICQ: 141057403 > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Phpwebsite-developers mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpwebsite-developers > > > > |
From: Matthew M. <ma...@tu...> - 2002-10-29 15:01:53
|
> I haven't seen the function code, but have you looked at this: > http://pear.php.net/manual/en/core.db.tableinfo.php Yes, that is what I am using, but the dev would have to foreach it and extract the name. This is just a shortcut. Originally I thought I would just pull a row and parse it, but then remembered a table may be blank. The PEAR function does the trick :) Matthew McNaney Internet Systems Architect Electronic Student Services Email: ma...@tu... URL: http://phpwebsite.appstate.edu Phone: 828-262-6493 ICQ: 141057403 |
From: Don S. <do...@se...> - 2002-10-29 15:03:42
|
Coolsville. Don. On Tue, 29 Oct 2002, Matthew McNaney wrote: > > I haven't seen the function code, but have you looked at this: > > http://pear.php.net/manual/en/core.db.tableinfo.php > > Yes, that is what I am using, but the dev would have to foreach it and > extract the name. This is just a shortcut. > > Originally I thought I would just pull a row and parse it, but then > remembered a table may be blank. > > The PEAR function does the trick :) > > Matthew McNaney > Internet Systems Architect > Electronic Student Services > Email: ma...@tu... > URL: http://phpwebsite.appstate.edu > Phone: 828-262-6493 > ICQ: 141057403 > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Phpwebsite-developers mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpwebsite-developers > > > > |
From: Steven L. <st...@tu...> - 2002-10-29 15:15:44
|
Is the describe command mysql specific, because it does the same thing as show columns? > While rewriting the sqlImport function, I needed a way to grab the > column names of a table. > > I remember someone telling me that the 'show columns' command is MySQL > specific. So I wrote a function named getColumnNames($tableName). > > You pass it the name of the table and it returns an array of all the > names. > > Give me a +1 amen and I will commit it or gimme a damnation -1 and tell > me if there is an easier way that I haven't located. > > Thanks, > Matt > > Matthew McNaney > Internet Systems Architect > Electronic Student Services > Email: ma...@tu... > URL: http://phpwebsite.appstate.edu > Phone: 828-262-6493 > ICQ: 141057403 > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Phpwebsite-developers mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpwebsite-developers -- Steven Levin Electronic Student Services Appalachian State University Phone: 828.262.2431 PhpWebsite Development Team URL: http://phpwebsite.appstate.edu Email: st...@NO... |
From: Adam M. <ad...@tu...> - 2002-10-29 15:45:10
|
+1 to Matt's function using the pear method. Describe is not mysql specific but I don't think it is universal either (I dont think it works on ORACLE) Adam > Is the describe command mysql specific, because it does the same thing > as show columns? > > > >> While rewriting the sqlImport function, I needed a way to grab the >> column names of a table. >> >> I remember someone telling me that the 'show columns' command is MySQL >> specific. So I wrote a function named getColumnNames($tableName). >> >> You pass it the name of the table and it returns an array of all the >> names. >> >> Give me a +1 amen and I will commit it or gimme a damnation -1 and >> tell me if there is an easier way that I haven't located. >> >> Thanks, >> Matt >> >> Matthew McNaney >> Internet Systems Architect >> Electronic Student Services >> Email: ma...@tu... >> URL: http://phpwebsite.appstate.edu >> Phone: 828-262-6493 >> ICQ: 141057403 >> >> >> >> >> ------------------------------------------------------- >> This sf.net email is sponsored by:ThinkGeek >> Welcome to geek heaven. >> http://thinkgeek.com/sf >> _______________________________________________ >> Phpwebsite-developers mailing list >> Php...@li... >> https://lists.sourceforge.net/lists/listinfo/phpwebsite-developers > > > -- > Steven Levin > Electronic Student Services > Appalachian State University > Phone: 828.262.2431 > PhpWebsite Development Team > URL: http://phpwebsite.appstate.edu > Email: st...@NO... > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Phpwebsite-developers mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpwebsite-developers --------------------------------- Adam Morton Developer - Electronic Student Services http://phpwebsite.appstate.edu Founder - ASU Linux Users Group http://lug.appstate.edu |
From: Matthew M. <ma...@tu...> - 2002-10-29 15:46:41
|
> Is the describe command mysql specific, because it does the same thing > as show columns? Good question. I'm not sure. I was unable to find the DESCRIBE command in the PostGre documentation however. Matthew McNaney Internet Systems Architect Electronic Student Services Email: ma...@tu... URL: http://phpwebsite.appstate.edu Phone: 828-262-6493 ICQ: 141057403 |
From: Steven L. <st...@tu...> - 2002-10-29 15:52:32
|
Oh well, just curious +1 to your function using PEAR >> Is the describe command mysql specific, because it does the same thing >> as show columns? > > Good question. I'm not sure. I was unable to find the DESCRIBE command > in the PostGre documentation however. > > > Matthew McNaney > Internet Systems Architect > Electronic Student Services > Email: ma...@tu... > URL: http://phpwebsite.appstate.edu > Phone: 828-262-6493 > ICQ: 141057403 > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Phpwebsite-developers mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpwebsite-developers -- Steven Levin Electronic Student Services Appalachian State University Phone: 828.262.2431 PhpWebsite Development Team URL: http://phpwebsite.appstate.edu Email: st...@NO... |