Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-20-2006, 03:30 PM   PM User | #1
bazz
Master Coder

 
Join Date: Apr 2003
Location: in my house
Posts: 5,211
Thanks: 39
Thanked 201 Times in 197 Posts
bazz will become famous soon enoughbazz will become famous soon enough
querying a mysql table

Hi,

Still a newbie to mySQL.

I want to query a specific table in the Db and output all the filed names to my perl script. This is for building a web form on the fly for adding new subscribers.

I am confused between building an array of the fields info and, querying using a $query variable.

here is the query code so far.

Code:
my $db = 'this';
  my $server = 'that';
  my $port = '1234';
  my $user = 'theOther';
  my $pass = 'another';
  my $fieldsInAccountsTable;

  my $dbh = DBI->connect("DBI:mysql:$db:$server:$port", $user, $pass,
                     {RaiseError => 1, PrintError => 0, AutoCommit => 1})
        or die "Can't connect: DBI->errstr()";

  my $fieldsInAccountTable = I'm stuck here

# disconnect from the MySQL server
$dbh->disconnect();

Bazz
bazz is offline   Reply With Quote
Old 07-20-2006, 04:01 PM   PM User | #2
Kid Charming
Regular Coder

 
Join Date: Jun 2005
Posts: 804
Thanks: 0
Thanked 0 Times in 0 Posts
Kid Charming is an unknown quantity at this point
You can get a list of columns with a SHOW COLUMNS query.
Kid Charming is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:43 PM.


Advertisement
Log in to turn off these ads.