|
|
Getting data from MySQL in XML - Mysql
|
Views : 389
|
|
Tagged in : Mysql
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
The following code is used to get the mysql output in XML format,
>mysql -u login_name -p password -X -e "select * from table_name" database_name
Sample Result:
<?xml version="1.0"?>
<resultset statement="select * from test">
<row>
<id>1</id>
<name>me</name>
<age>88</age>
</row>
<row>
<id>2</id>
<name>you</name>
<age>10</age>
</row>
<row>
<id>3</id>
<name>she</name>
<age>25</age>
</row>
</resultset>
You can also get the output in html format using -H option
>mysql -u login_name -p password -H -e "select * from table_name" database_name
Sample Output:
<table BORDER=1><tr><th>id</th><th>name</th><th>age</th></tr><tr><td>1</td><td>m
e</td><td>88</td></tr><tr><td>2</td><td>you</td><td>10</td></tr><tr><td>3</td><t D>she<td>25</td></t></tr></table>
|
|
By - Rekha, On - 2009-12-10 |
|
|
|