Foros       Consigue tu camiseta aquí
Exportar datos sql a xml y guardarlo en un host

 
Publicar Nuevo Tema   Responder al Tema    Índice del Foro www.Android-Spa.com -> General
Mostrar mensajes anteriores:   

davidte

Mensajes: 12
MensajePublicado: Sab Ago 27, 2011 12:12 am    Título del mensaje: Exportar datos sql a xml y guardarlo en un host Enviar mensaje privado Responder citando

Hola!
Estoy intentando hacer, y por más que busco no encuentro, como poder exportar los datos de mi base de datos sql a xml, y poder guardarlo en mi host, automáticamente, y que se actualice cada cierto tiempo.
He buscado y solo he encontrado esto, y no se muy bien para que sirve:

<?php
// database constants
// make sure the information is correct
define("DB_SERVER", "localhost");
define("DB_USER", "root");
define("DB_PASS", "password");
define("DB_NAME", "tutorials");

// connection to the database
$dbhandle = mysql_connect(DB_SERVER, DB_USER, DB_PASS)
or die("Unable to connect to MySQL");

// select a database to work with
$selected = mysql_select_db(DB_NAME, $dbhandle)
or die("Could not select examples");

// return all available tables
$result_tbl = mysql_query( "SHOW TABLES FROM ".DB_NAME, $dbhandle );

$tables = array();
while ($row = mysql_fetch_row($result_tbl)) {
$tables[] = $row[0];
}

$output = "<?xml version=\"1.0\" ?>\n";
$output .= "<schema>";

// iterate over each table and return the fields for each table
foreach ( $tables as $table ) {
$output .= "<table name=\"$table\">";
$result_fld = mysql_query( "SHOW FIELDS FROM ".$table, $dbhandle );

while( $row1 = mysql_fetch_row($result_fld) ) {
$output .= "<field name=\"$row1[0]\" type=\"$row1[1]\"";
$output .= ($row1[3] == "PRI") ? " primary_key=\"yes\" />" : " />";
}

$output .= "</table>";
}

$output .= "</schema>";

// tell the browser what kind of file is come in
header("Content-type: text/xml");
// print out XML that describes the schema
echo $output;

// close the connection
mysql_close($dbhandle);
?>

Darknoe

Mensajes: 828
MensajePublicado: Sab Ago 27, 2011 1:02 pm    Título del mensaje: Enviar mensaje privado Responder citando

Ése código es php. Leyendote el código puedes entender que hace.

Creo que primero tienes que enterarte qué quieres hacer, dónde lo quieres hacer y cómo lo quieres hacer.

La base de datos es MySql en tu servidor? O es una Sqlite en tu móvil?

Normalmente TÚ haces el código, TÚ haces el bucle de pasar los datos de la BBDD a XML y TÚ lo guardas en tu host, no vas a encontrar nada hecho a medida.

happydis

Mensajes: 16
MensajePublicado: Mar Mar 06, 2012 1:25 am    Título del mensaje: Enviar mensaje privado Responder citando

Hola yo tengo una duda similar:

Debo acceder a un BD remota en MySQL, y descargarla completamnete en una BD SQLite en el movil, viendo ejemplos y tutoriales he encontrado la forma de acceder y hacer modificaciones, pero aun no logro optener datos y mucho menos descargar todo.
No se si hacer un foreach para cada tabla sea la mejor solucion. =S

Espero que puedan ayudarme.

tina2012

Mensajes: 12
MensajePublicado: Mie Mar 21, 2012 6:43 am    Título del mensaje: the activation of office 2010 Enviar mensaje privado Responder citando

My company has many the activation key of office 2010 .As we known, the purchase of the right to use of this software is very expensive.The activation of office 2010 is very favorable in my company . compared to the purchase price , we only need spend a little money on it. available for your choice is many.Such asmicrosoft office 2010
office standard 2010]microsoft office2010
office proffesional 2010
office 2010 student discount,
office home business 2010
visio premium 2010
microsoft home and student 2010 download。If you want to buy office 2010, You can visit our website to find out you need information .Through
reading and understooding ,we can know the good.If you had buy my company's products, I am sure you will not regret it.Our company's aim is first-class service, top quality, second-rate prices.You will be satisfied with the product.

Publicar Nuevo Tema   Responder al Tema    Índice del Foro www.Android-Spa.com -> General Todas las horas están en GMT + 2 Horas
Página 1 de 1
Ver tema anterior :: Ver siguiente tema  

 
Saltar a:  
No puede crear mensajes
No puede responder temas
No puede editar sus mensajes
No puede borrar sus mensajes
No puede votar en encuestas