13, February 2012
query - first result is all column names - webmaster forum
Navigation
Webdigity Services
Pagerank Monitor
Whois Tool
Web Design Gallery
Webmaster Forums
Webmaster Directory
Tutorials Database
Webmaster Forums
WebDigity Community
Topsites network news ...
Forum Contests
Forum Lounge
New Member Introductions
Tech News
User Forums
aStatSpam forum
Computers
3rd-Party Scripting
Leet Link Directory
The 100 Lists Website ...
Design and Layout
Newbie webmaster
Graphics & Multimedia
Adobe Photoshop
Macromedia Flash & Act...
Web Page Design
HTML & XHTML
CSS
Accesibility issues
Website & Graphic Revi...
Web Development
PhP
ASP & .NET
Java & JSP
Official Java News
JavaScript
XML - XSLT
Databases
MySQL
Security
Web hosting talk
Hosting companies
Domain names
Configuring your server
Apache web server
Marketing your site
CPC programs
Chitika eMiniMalls
CPM programs
Affiliate programs & o...
Web site promotion
Promotion techniques
Search Engine Optimiza...
Google SEO
Promoting & building a...
Marketplace
Advertise your services
Sell your site
Sell a domain name
Request services
Hire people
Link trading requests
[
Home
|
Help
|
Search
|
Forum's Shop
|
Archive
|
Login
|
Register
|
Webmaster Directory
]
Web
www.webdigity.com
Hide the search bar
Whois database search :
Domain :
Use the whois database tool to retrieve information on any top level domain you are interested in.
Webdigity Webmaster Forums
>
Web Development
>
Databases
Topic:
query - first result is all column names
« previous
next »
Pages: [
1
]
Author
Topic: query - first result is all column names (Read 1692 times)
Community Supporter
?
Hunky Junky Monky Man!
Gender:
Posts: 68
436 credits
Members referred : 0
Schwa?
«
on:
Feb 09, 2008, 04:15:44 am »
Lets say you have a 3 column database with colums of 'id', 'username' and 'registrationDate'
So lets say you want to generate a csv with somethignl ike mysql, you can.... but lets put the column names on the top. Cool
Select 'id', 'username', 'registrationDate'
union
Select * from tableName;
coolios.
Now here's the thing - how would you make it be a dynamic thing? I don't want to modify this particular query whenever I add a new column.
(If you ask why - go for it - I'll explain - but I don't think its needed for the solution.)
Any ideas are more than welcome.
Global Moderator
Community Supporter
?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits
Members referred : 374
It's time to use PHP5!
«
Reply #1 on:
Feb 09, 2008, 08:16:28 am »
is ity this what you mean:
$result = mysql_query(sprintf("SELECT * FROM %s", $this->table));
$i = 0;
while ($i < mysql_num_fields($result)) {
$type = mysql_field_type($result, $i);
$name = mysql_field_name($result, $i);
$this->table_fields[$name] = $type;
$i++;
}
Website Monitoring Service
Free WordPress Themes
Magento Templates
Last blog :
A new Wordpress theme for our blog
I am a metal monkey!
Administrator
Community Supporter
?
Jedai Sword Master
Gender:
Posts: 5778
46265 credits
Members referred : 3
«
Reply #2 on:
Feb 09, 2008, 11:03:29 am »
You can do what you want with 2 queries. The one is this :
SHOW COLUMNS FROM `table`
Then get the `Field` field from that table, and then call a
SELECT * FROM `table`
to fetch all the data.
Trial and Error my two best teachers
Join us @ facebook
or
twitter
Last blog :
Butterfly Marketing 2.0
Community Supporter
?
Hunky Junky Monky Man!
Gender:
Posts: 68
436 credits
Members referred : 0
Schwa?
«
Reply #3 on:
Feb 10, 2008, 03:30:12 am »
Let me clear it up - it all has to be written as a SQL script or a set of them that can be ran into the mysql CLI.
So - olaf: no access to PHP
Nikolas: show columns shows the columns with descriptive data in rows. I need the results in one row - multiple columns.
Thanks!
Trackback URI for this entry :
http://www.webdigity.com/trackback.php?topic=7581
Tags :
dynamic headers
Bookmark this thread :
Digg
Del.icio.us
Dzone
more....
Pages: [
1
]
Webdigity Webmaster Forums
>
Web Development
>
Databases
Topic:
query - first result is all column names
« previous
next »
Jump to:
=>Personal Messages
=>My Subscriptions
=>Profile Settings
=>Account Settings
=>Look and Layout Settings
=>Unread Posts
=>Unread Replies To My Posts
=>Affiliate Program
=>Forum's Shop
=>Arcade
Category: WebDigity Community
=> HumanWorks network news & feedback
===> Clickbank Contextual Script Support
=> Forum Contests
=> Forum Lounge
===> New Member Introductions
===> Tech News
===> Google Forum
=> User Forums
Category: Design and Layout
=> General webmaster discussions
=> Graphics & Multimedia
===> Adobe Photoshop
===> Macromedia Flash & Actionscript
=> Web Page Design
===> HTML & XHTML
===> CSS
===> Accesibility issues
=> Website & Graphic Reviews
Category: Web Development
=> PhP
===> PHP classes @finalwebsites.com
=====> Easy PHP Upload
=====> Access_user Class
=====> Validate_fields Class
=====> DB_cart Class
=====> Miscellaneous scripts or snippets
=====> PHP Whois script
=====> 3rd party modifications
===> Php User Class
=> JavaScript
=> Databases
===> MySQL
=> Security
=> Miscellaneous Languages
===> ASP & .NET
===> Java & JSP
=====> Official Java News
Category: Web hosting talk
=> Hosting companies
=> Domain names
=> Configuring your server
===> Apache web server
Category: Monetizing your site
=> General Business
=> CPC programs
===> Adsense
===> Chitika eMiniMalls
=====> Official news from Chitika
=====> Ad placement reviews
=====> eMiniMalls feedback and suggestions
=> CPM programs
=> Affiliate programs & other revenue models
Category: Web site promotion
=> Promotion techniques
=> Search Engine Optimization
===> Google SEO
=> Promoting & building a forum
===> SMF moding & promoting
Category: Marketplace
=> Advertise your services
===> Web Hosting Deals
=> Sell your site
=> Sell a domain name
=> Request services
=> Hire people
=> Link trading requests
User Area
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
Feb 13, 2012, 08:17:08 pm
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Donate to our community, and get a permanent link back to your site!
Forum Statistics
Total Posts:
59.816
Total Topics:
10.612
Total Members:
19.610
Tutorials
:
58
Resources
:
929
Designs
:
395
Latest Member:
pandrews
115 Guests, 1 User online :
Googlebot
53 users online today:
SecuredServers
,
pandrews
,
Fisa
,
WebTalent
,
agelore
,
Denis
,
bernarder
,
Nikolas
,
masterresalerights
,
johnhermanrealtor
,
raheel1
,
atarjamat
,
Rico Leeds
,
johnsander
,
stephanielumm
,
allomkt
,
aaqil
,
Isidore
,
steffytailor
,
gladiolus
,
froz
,
shaunshenker
,
alexabc123fgh
,
tagreplica
,
lotusstar2012
,
lothmajo
,
bouiesimon
,
dpsubi1
,
bradd.weyand
,
Proaxxs-peter
,
nickwhiz
,
FurnitureBuyer
,
avandersrosa
,
markjarry99
,
juanhazelgrove
,
webaddik
,
C.Rebecca
,
ranajon
,
kovachmoira
,
yiyi
,
alishakcarter
,
jhonden
,
kkk123
,
mattebop
,
retaschieber
,
sumowd1
,
hiraowdvoj12
,
dtj2011
,
kobe
,
marksebastian04
,
sara
,
Duncan M.
,
skejerr
Recent topics
Re: What is reseller? ...
offshore hosting with DDoS ...
Re: Selling yahoo level 2 a...
Re: Can i reactivate my yah...
Re: google or yahoo?
Re: what is off site seo?...
Re: How to use Javascript i...
Re: Steps to Affiliate Succ...
HumanWorks Network
Technology news
Webmaster articles
Sublime web directory
RSS Feed directory and viewer
Web Design Gallery
·
Whois Lookup
·
Pagerank
·
Tag Browsing
·
Lo-fi version
·
Syndication
·
Webmaster forum history
·
Advertise
Developed by
HumanWorks
© 2005 - 2012
Webdigity webmaster community
·
sublime directory
Webdigity Webmaster Forums | Powered by
SMF 1.0.12
. © 2001-2005,
Lewis Media
. All Rights Reserved.