Jump to content

Mysqldump Table Issue


jazzman1

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/271264-mysqldump-table-issue/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.