MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 3rd, 2008, 12:56 PM
takeiteasyonme takeiteasyonme is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2008
Posts: 71 takeiteasyonme User rank is Private First Class (20 - 50 Reputation Level)takeiteasyonme User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 20 h 7 m 32 sec
Reputation Power: 6
Format query output at mysql prompt?

I'm just wondering if there's a way to print out the results from a query conducted at the mysql prompt so that it's a little easier to read.

Rather than:

field a | field b | field c
+---------------+-------------+-------------+
| 100 | abcedef | ghijklmnop

is there a way to print to screen so that it looks like this:

field a | 100
field b | abcedef
field c | ghijklmnop

Reply With Quote
  #2  
Old June 3rd, 2008, 01:17 PM
TonyF123 TonyF123 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2007
Location: Purley, Surrey
Posts: 242 TonyF123 User rank is Sergeant Major (2000 - 5000 Reputation Level)TonyF123 User rank is Sergeant Major (2000 - 5000 Reputation Level)TonyF123 User rank is Sergeant Major (2000 - 5000 Reputation Level)TonyF123 User rank is Sergeant Major (2000 - 5000 Reputation Level)TonyF123 User rank is Sergeant Major (2000 - 5000 Reputation Level)TonyF123 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 12 h 47 m 56 sec
Reputation Power: 27
Quote:
Originally Posted by takeiteasyonme
I'm just wondering if there's a way to print out the results from a query conducted at the mysql prompt so that it's a little easier to read.

Rather than:

field a | field b | field c
+---------------+-------------+-------------+
| 100 | abcedef | ghijklmnop

is there a way to print to screen so that it looks like this:

field a | 100
field b | abcedef
field c | ghijklmnop


Not sure it's any easier to read but try terminating with a \G instead of a ; for that type of display

Reply With Quote
  #3  
Old June 3rd, 2008, 01:47 PM
takeiteasyonme takeiteasyonme is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2008
Posts: 71 takeiteasyonme User rank is Private First Class (20 - 50 Reputation Level)takeiteasyonme User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 20 h 7 m 32 sec
Reputation Power: 6
Perfect! Thanks!

Reply With Quote
  #4  
Old November 26th, 2012, 12:58 PM
phapalegaurav phapalegaurav is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 1 phapalegaurav User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 59 sec
Reputation Power: 0
MySQL query ouput can be formatted in better way using \P less -S option as below:

mysql> \P less -S
mysql> <SELECT QUERY>

Reply With Quote
  #5  
Old December 4th, 2012, 01:02 PM
Heyyysimon Heyyysimon is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 1 Heyyysimon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 12 sec
Reputation Power: 0
Is there a way to format MySQL query output that is printed to a browser window? Like an HTML and JavaScript website that uses php to make MySQL queries. I would like to format my output into easily readable HTML tables and use some CSS.

Thanks in advance for any suggestions!

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Format query output at mysql prompt?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap