jazzman1 Posted November 27, 2012 Share Posted November 27, 2012 (edited) Hey friends, Let's say that I have a database named - "test". Inside this database, I have a table, it's called - 'product'. If I try to get an information from the product table produsing as html output, I'm using the code below. Example: [jazzman@localhost ~]$ mysql -h localhost -u jazzman --password='password' --html mysql> use test; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> SELECT * FROM product; <TABLE BORDER=1><TR><TH>id</TH><TH>name</TH><TH>purchase_id</TH></TR><TR><TD>1</TD><TD>Lawn Mower</TD><TD>1</TD></TR><TR><TD>2</TD><TD>Greenhouse</TD><TD>1</TD></TR><TR><TD>3</TD><TD>Paving slab</TD><TD>2</TD></TR><TR><TD>4</TD><TD>BBQ</TD><TD>2</TD></TR><TR><TD>5</TD><TD>Chainsaw</TD><TD>5</TD></TR><TR><TD>6</TD><TD>Power-MP3 5gb</TD><TD>2</TD></TR><TR><TD>7</TD><TD>Super-Player 1gb</TD><TD>3</TD></TR><TR><TD>8</TD><TD>Porta CD</TD><TD>3</TD></TR><TR><TD>9</TD><TD>36" TV</TD><TD>1</TD></TR><TR><TD>10</TD><TD>Family Talk 360</TD><TD>5</TD></TR></TABLE>10 rows in set (0.00 sec) What I want to do is, runing a mysqldump to get only this particular html output. What do you think, is it possible? Thanks in advance. Edited November 27, 2012 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/271264-mysqldump-table-issue/ Share on other sites More sharing options...
Muddy_Funster Posted November 28, 2012 Share Posted November 28, 2012 I don't think you can apply formating to a mysqldump, that said - I have never thought to try. It's not supposed to produce a nice shiny report, it's ment as a backup tool. Quote Link to comment https://forums.phpfreaks.com/topic/271264-mysqldump-table-issue/#findComment-1395838 Share on other sites More sharing options...
jazzman1 Posted November 28, 2012 Author Share Posted November 28, 2012 I don't think you can apply formating to a mysqldump, that said - I have never thought to try. It's not supposed to produce a nice shiny report, it's ment as a backup tool. @muddy, I've never thought to try, too Actually, this is a question from one bulgarian forum. The guy of that forum doesn't have a web server neither any knowledges of server side languages. He knows only html and a little sql. His question was, is it a way to generate database tables as html document(s) in my browser? I've suggested him to use a mysqldump tool dumping tables as xml document, after that just using javascript to retrieve this data, but he doesn't have any experience in javascript, too. Well, that's the story Anyway, I wrote a simple bash script which get the data from db tables saving it in html document. It works properly. Example: #!/bin/sh CMD="use test;select * from product" /usr/bin/mysql -h 127.0.0.1 -u jazzman --password="password" --html -e "$CMD" > /home/jazzman/index.html Have a good one. Quote Link to comment https://forums.phpfreaks.com/topic/271264-mysqldump-table-issue/#findComment-1395912 Share on other sites More sharing options...
fenway Posted November 30, 2012 Share Posted November 30, 2012 I believe there's an XML export option. Quote Link to comment https://forums.phpfreaks.com/topic/271264-mysqldump-table-issue/#findComment-1396368 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.