Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
| Search | Today's Posts | Mark Forums Read
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 16th, 2006, 10:23 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default show just the column names from a MySQL command

Is there anyway to show just the column names from a MySQL command?

i.e. dont show the type and things like that

www.crmpicco.co.uk
www.ie7.com
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old November 16th, 2006, 10:29 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Oklahoma City, Oklahoma, USA.
Posts: 249
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello, I was just working on this last night

    $query = "SELECT fieldid, field1, field2, field3 FROM YourTABLE WHERE fieldid = '1'";

    $result = mysql_query($query)
            or die("Error.");

    $iNumFields = mysql_num_fields($result);
    echo $iNumFields . "<BR>";

    $row = mysql_fetch_array($result);
    for ($i = 0; $i<$iNumFields; $i++) {
        echo mysql_field_name($result, $i);
    }

Peace
Mike
 
Old November 16th, 2006, 01:06 PM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

ah, i see what you are doing - but i was meaning from the command prompt when running mysql, e.g.


mysql>

www.crmpicco.co.uk
www.ie7.com
 
Old November 26th, 2006, 04:41 PM
Registered User
 
Join Date: Sep 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

u can try "describe table"

 
Old November 29th, 2006, 05:01 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

yeah, describe table_name was what i tried to start with. but it shows all table info

www.crmpicco.co.uk
www.ie7.com
 
Old December 7th, 2006, 08:34 AM
Authorized User
 
Join Date: Nov 2006
Location: Bhopal, MP, India.
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to talk2leo
Default

select clounmname where columnname like 'field1'

try it

Success is Never Ending,,Failure is Never Final




Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic column names in crystal reports pankaj_daga Crystal Reports 3 January 19th, 2009 02:55 AM
Displaying Table Column/Fields names in a listbox Durkee VB.NET 2002/2003 Basics 4 September 25th, 2007 03:37 PM
Column names! Help! dirtdog22 Access VBA 6 June 1st, 2007 06:37 AM
how to Retrieve Column Names Using SQL Query saravananedu Oracle 2 September 10th, 2005 01:57 AM
Query for Column Names and Datatypes rstelma SQL Server 2000 3 August 23rd, 2005 02:52 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.